Index: openacs-4/contrib/packages/simulation/lib/sim-template-tasks.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/sim-template-tasks.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/simulation/lib/sim-template-tasks.adp 30 Oct 2003 11:15:55 -0000 1.1
@@ -0,0 +1,5 @@
+
+
+
+ Add a task
+
\ No newline at end of file
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/simulation/lib/sim-template-tasks.tcl 30 Oct 2003 11:15:55 -0000 1.1
@@ -0,0 +1,92 @@
+# an includelet
+
+# the includelet can be a full edit
+
+if { ![exists_and_not_null usage_mode] } {
+ set usage_mode display
+}
+
+switch $usage_mode {
+ display {}
+ edit {
+ set add_task_url [export_vars -base "task-edit" { workflow_id } ]
+ }
+ default {
+ error "This is an opportunity to inspect the code and find out how we got here, since it should be impossible"
+ }
+}
+
+##############################################################
+#
+# tasks
+#
+# A list of all tasks associated with the Simulation Template
+#
+##############################################################
+
+#-------------------------------------------------------------
+# tasks list
+#-------------------------------------------------------------
+# TODO: missing: discription, type
+# how is type going to work? open question pending prototyping
+
+
+
+template::list::create \
+ -name tasks \
+ -multirow tasks \
+ -no_data "No tasks in this Simulation Template" \
+ -elements {
+ edit {
+ hide_p {[ad_decode $usage_mode edit 0 1]}
+ sub_class narrow
+ link_url_col edit_url
+ display_template {
+
+ }
+ }
+ name {
+ label "Name"
+ link_url_col {[ad_decode $usage_mode edit view_url ""]}
+ }
+ assigned_name {
+ label "Assigned to"
+ }
+ recipient_name {
+ label "Recipient"
+ }
+ delete {
+ sub_class narrow
+ link_url_col delete_url
+ hide_p {[ad_decode $usage_mode edit 0 1]}
+ display_template {
+
+ }
+ }
+ }
+
+#-------------------------------------------------------------
+# tasks db_multirow
+#-------------------------------------------------------------
+# TODO: fix this so it returns rows when it should
+
+db_multirow -extend { edit_url view_url delete_url } tasks select_tasks "
+ select wa.action_id,
+ wa.pretty_name as name,
+ (select pretty_name
+ from workflow_roles
+ where role_id = wa.assigned_role) as assigned_name,
+ (select pretty_name
+ from workflow_roles
+ where role_id = st.recipient) as recipient_name,
+ wa.sort_order
+ from workflow_actions wa,
+ sim_tasks st
+ where wa.workflow_id = :workflow_id
+ and st.task_id = wa.action_id
+ [template::list::orderby_clause -orderby -name "tasks"]
+" {
+ set edit_url [export_vars -base "task-edit" { action_id }]
+ set view_url [export_vars -base "task-edit" { action_id }]
+ set delete_url [export_vars -base "task-delete" { action_id }]
+}
Index: openacs-4/contrib/packages/simulation/www/sim-template-edit.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/Attic/sim-template-edit.adp,v
diff -u -r1.3 -r1.4
--- openacs-4/contrib/packages/simulation/www/sim-template-edit.adp 29 Oct 2003 12:57:13 -0000 1.3
+++ openacs-4/contrib/packages/simulation/www/sim-template-edit.adp 30 Oct 2003 11:15:55 -0000 1.4
@@ -11,5 +11,5 @@
Roles
Tasks
-
+
\ No newline at end of file
Index: openacs-4/contrib/packages/simulation/www/task-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/Attic/task-edit.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/packages/simulation/www/task-edit.tcl 29 Oct 2003 12:57:13 -0000 1.1
+++ openacs-4/contrib/packages/simulation/www/task-edit.tcl 30 Oct 2003 11:15:55 -0000 1.2
@@ -64,7 +64,9 @@
# task form
#---------------------------------------------------------------------
-ad_form -name task -cancel_url sim-template-list -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
@@ -79,12 +81,18 @@
{label "Recipient"}
{options $role_options}
}
+ {description:richtext,optional
+ {label "Task Description"}
+ {html {cols 60 rows 8}}
+ }
} -edit_request {
# Retrieve the task and populate the form
workflow::action::fsm::get -action_id $action_id -array task_array
+ # 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)]
workflow::get -workflow_id $workflow_id -array sim_template_array
set page_title "Edit Task $name"
set context [list [list "sim-template-list" "Sim Templates"] [list "sim-template-edit?workflow_id=$workflow_id" "$sim_template_array(pretty_name)"] $page_title]
@@ -96,14 +104,24 @@
set page_title "Add Task to $sim_template_array(pretty_name)"
set context [list [list "sim-template-list" "Sim Templates"] [list "sim-template-edit?workflow_id=$workflow_id" "$sim_template_array(pretty_name)"] $page_title]
+} -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 action_id [workflow::action::fsm::new \
- -workflow_id $workflow_id \
- -short_name $name \
- -pretty_name $name \
- -assigned_role $assigned_role]
+ -workflow_id $workflow_id \
+ -short_name $name \
+ -pretty_name $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
@@ -119,7 +137,9 @@
-short_name $name \
-pretty_name $name \
-assigned_role $assigned_role \
- -recipient_role $recipient_role
+ -recipient_role $recipient_role \
+ -description $description_content \
+ -description_mime_type $description_mime_type
} -after_submit {
ad_returnredirect [export_vars -base "sim-template-edit" { workflow_id }]
Index: openacs-4/packages/simulation/lib/sim-template-tasks.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/sim-template-tasks.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/simulation/lib/sim-template-tasks.adp 30 Oct 2003 11:15:55 -0000 1.1
@@ -0,0 +1,5 @@
+
+
+
+ Add a task
+
\ No newline at end of file
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/simulation/lib/sim-template-tasks.tcl 30 Oct 2003 11:15:55 -0000 1.1
@@ -0,0 +1,92 @@
+# an includelet
+
+# the includelet can be a full edit
+
+if { ![exists_and_not_null usage_mode] } {
+ set usage_mode display
+}
+
+switch $usage_mode {
+ display {}
+ edit {
+ set add_task_url [export_vars -base "task-edit" { workflow_id } ]
+ }
+ default {
+ error "This is an opportunity to inspect the code and find out how we got here, since it should be impossible"
+ }
+}
+
+##############################################################
+#
+# tasks
+#
+# A list of all tasks associated with the Simulation Template
+#
+##############################################################
+
+#-------------------------------------------------------------
+# tasks list
+#-------------------------------------------------------------
+# TODO: missing: discription, type
+# how is type going to work? open question pending prototyping
+
+
+
+template::list::create \
+ -name tasks \
+ -multirow tasks \
+ -no_data "No tasks in this Simulation Template" \
+ -elements {
+ edit {
+ hide_p {[ad_decode $usage_mode edit 0 1]}
+ sub_class narrow
+ link_url_col edit_url
+ display_template {
+
+ }
+ }
+ name {
+ label "Name"
+ link_url_col {[ad_decode $usage_mode edit view_url ""]}
+ }
+ assigned_name {
+ label "Assigned to"
+ }
+ recipient_name {
+ label "Recipient"
+ }
+ delete {
+ sub_class narrow
+ link_url_col delete_url
+ hide_p {[ad_decode $usage_mode edit 0 1]}
+ display_template {
+
+ }
+ }
+ }
+
+#-------------------------------------------------------------
+# tasks db_multirow
+#-------------------------------------------------------------
+# TODO: fix this so it returns rows when it should
+
+db_multirow -extend { edit_url view_url delete_url } tasks select_tasks "
+ select wa.action_id,
+ wa.pretty_name as name,
+ (select pretty_name
+ from workflow_roles
+ where role_id = wa.assigned_role) as assigned_name,
+ (select pretty_name
+ from workflow_roles
+ where role_id = st.recipient) as recipient_name,
+ wa.sort_order
+ from workflow_actions wa,
+ sim_tasks st
+ where wa.workflow_id = :workflow_id
+ and st.task_id = wa.action_id
+ [template::list::orderby_clause -orderby -name "tasks"]
+" {
+ set edit_url [export_vars -base "task-edit" { action_id }]
+ set view_url [export_vars -base "task-edit" { action_id }]
+ set delete_url [export_vars -base "task-delete" { action_id }]
+}
Index: openacs-4/packages/simulation/www/sim-template-edit.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/Attic/sim-template-edit.adp,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/simulation/www/sim-template-edit.adp 29 Oct 2003 12:57:13 -0000 1.3
+++ openacs-4/packages/simulation/www/sim-template-edit.adp 30 Oct 2003 11:15:55 -0000 1.4
@@ -11,5 +11,5 @@
Roles
Tasks
-
+
\ No newline at end of file
Index: openacs-4/packages/simulation/www/task-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/Attic/task-edit.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/simulation/www/task-edit.tcl 29 Oct 2003 12:57:13 -0000 1.1
+++ openacs-4/packages/simulation/www/task-edit.tcl 30 Oct 2003 11:15:55 -0000 1.2
@@ -64,7 +64,9 @@
# task form
#---------------------------------------------------------------------
-ad_form -name task -cancel_url sim-template-list -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
@@ -79,12 +81,18 @@
{label "Recipient"}
{options $role_options}
}
+ {description:richtext,optional
+ {label "Task Description"}
+ {html {cols 60 rows 8}}
+ }
} -edit_request {
# Retrieve the task and populate the form
workflow::action::fsm::get -action_id $action_id -array task_array
+ # 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)]
workflow::get -workflow_id $workflow_id -array sim_template_array
set page_title "Edit Task $name"
set context [list [list "sim-template-list" "Sim Templates"] [list "sim-template-edit?workflow_id=$workflow_id" "$sim_template_array(pretty_name)"] $page_title]
@@ -96,14 +104,24 @@
set page_title "Add Task to $sim_template_array(pretty_name)"
set context [list [list "sim-template-list" "Sim Templates"] [list "sim-template-edit?workflow_id=$workflow_id" "$sim_template_array(pretty_name)"] $page_title]
+} -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 action_id [workflow::action::fsm::new \
- -workflow_id $workflow_id \
- -short_name $name \
- -pretty_name $name \
- -assigned_role $assigned_role]
+ -workflow_id $workflow_id \
+ -short_name $name \
+ -pretty_name $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
@@ -119,7 +137,9 @@
-short_name $name \
-pretty_name $name \
-assigned_role $assigned_role \
- -recipient_role $recipient_role
+ -recipient_role $recipient_role \
+ -description $description_content \
+ -description_mime_type $description_mime_type
} -after_submit {
ad_returnredirect [export_vars -base "sim-template-edit" { workflow_id }]