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.37 -r1.38 --- openacs-4/contrib/packages/simulation/lib/sim-template-tasks.tcl 26 Jan 2004 12:34:46 -0000 1.37 +++ openacs-4/contrib/packages/simulation/lib/sim-template-tasks.tcl 30 Jan 2004 11:17:16 -0000 1.38 @@ -248,9 +248,9 @@ } if { $counter > 1 } { - set up_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction up } { return_url [ad_return_url] } }] + set up_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction up } { return_url "[ad_return_url]\#tasks" } }] } - set down_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction down } { return_url [ad_return_url] } }] + set down_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction down } { return_url "[ad_return_url]\#tasks" } }] switch $trigger_type { workflow - parallel - dynamic { Index: openacs-4/contrib/packages/simulation/sql/postgresql/simulation-content-types-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/sql/postgresql/Attic/simulation-content-types-create.sql,v diff -u -r1.20 -r1.21 --- openacs-4/contrib/packages/simulation/sql/postgresql/simulation-content-types-create.sql 22 Jan 2004 14:08:39 -0000 1.20 +++ openacs-4/contrib/packages/simulation/sql/postgresql/simulation-content-types-create.sql 30 Jan 2004 11:17:16 -0000 1.21 @@ -306,6 +306,17 @@ 'integer' -- column_spec ); +select content_type__create_attribute( + 'sim_message', -- content_type + 'entry_id', -- attribute_name + 'integer', -- datatype + 'Entry ID', -- pretty_name + 'Entry IDs', -- pretty_plural + 4, -- sort_order + null, -- default_value + 'integer' -- column_spec +); + select content_type__register_relation_type ( 'sim_message', -- content_type 'sim_prop', -- target_type Index: openacs-4/contrib/packages/simulation/sql/postgresql/simulation-tables-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/sql/postgresql/Attic/simulation-tables-create.sql,v diff -u -r1.23 -r1.24 --- openacs-4/contrib/packages/simulation/sql/postgresql/simulation-tables-create.sql 23 Jan 2004 11:16:15 -0000 1.23 +++ openacs-4/contrib/packages/simulation/sql/postgresql/simulation-tables-create.sql 30 Jan 2004 11:17:16 -0000 1.24 @@ -163,6 +163,8 @@ on delete cascade, order_n integer, relation_tag varchar(100), + entry_id integer constraint scrom_case_log_fk + references workflow_case_log, constraint scrom_pk primary key (role_id, object_id, case_id, relation_tag) ); Index: openacs-4/contrib/packages/simulation/tcl/message-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/message-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/simulation/tcl/message-procs.tcl 26 Jan 2004 15:23:37 -0000 1.4 +++ openacs-4/contrib/packages/simulation/tcl/message-procs.tcl 30 Jan 2004 11:17:16 -0000 1.5 @@ -18,6 +18,7 @@ {-content_type "sim_message"} {-item_name ""} {-attachments ""} + {-entry_id {}} } { Create new simulation message. @@ -46,7 +47,8 @@ set attributes [list \ [list from_role_id $from_role_id] \ [list to_role_id $to_role_id] \ - [list case_id $case_id]] + [list case_id $case_id] \ + [list entry_id $entry_id]] set revision_id [bcms::revision::add_revision \ -item_id $item_id \ Index: openacs-4/contrib/packages/simulation/tcl/ui-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/ui-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/simulation/tcl/ui-procs.tcl 30 Jan 2004 10:57:08 -0000 1.3 +++ openacs-4/contrib/packages/simulation/tcl/ui-procs.tcl 30 Jan 2004 11:17:16 -0000 1.4 @@ -66,6 +66,7 @@ document_file title description + {entry_id {}} } { Does the document insertion in the DB. @@ -102,9 +103,9 @@ set relation_tag "portfolio" db_dml add_document_to_portfolio { insert into sim_case_role_object_map - (case_id, object_id, role_id, relation_tag) + (case_id, object_id, role_id, relation_tag, entry_id) values - (:case_id, :item_id, :role_id, :relation_tag) + (:case_id, :item_id, :role_id, :relation_tag, :entry_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.33 -r1.34 --- openacs-4/contrib/packages/simulation/www/simbuild/task-edit.tcl 26 Jan 2004 12:34:47 -0000 1.33 +++ openacs-4/contrib/packages/simulation/www/simbuild/task-edit.tcl 30 Jan 2004 11:17:16 -0000 1.34 @@ -128,11 +128,6 @@ {label "Task Name"} {html {size 50}} } - {pretty_past_tense:text,optional - {label "Task name in log"} - {html {size 50}} - {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'."} - } {trigger_type:text(radio) {label {[ad_decode $num_sub_actions 0 "Trigger Type" "Trigger Type
(Cannot edit because
task has child tasks)"]}} {mode {[ad_decode $num_sub_actions 0 "" "display"]}} @@ -269,7 +264,7 @@ set description [template::util::richtext::create $task_array(description) $task_array(description_mime_type)] foreach elm { - pretty_name pretty_past_tense new_state_id + pretty_name new_state_id assigned_role recipient_roles attachment_num trigger_type timeout_seconds parent_action_id } { @@ -312,10 +307,7 @@ } } - # Default pretty_past_tense - if { [empty_string_p $pretty_past_tense] } { - set pretty_past_tense $pretty_name - } + set pretty_past_tense $pretty_name foreach elm { pretty_name pretty_past_tense assigned_role description description_mime_type Index: openacs-4/contrib/packages/simulation/www/simplay/case-admin.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/case-admin.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/contrib/packages/simulation/www/simplay/case-admin.tcl 30 Jan 2004 10:29:16 -0000 1.12 +++ openacs-4/contrib/packages/simulation/www/simplay/case-admin.tcl 30 Jan 2004 11:17:16 -0000 1.13 @@ -164,7 +164,7 @@ -elements { timestamp { label "Time" - display_eval {[lc_time_fmt $creation_date_ansi "%X %x"]} + display_eval {[lc_time_fmt $creation_date_ansi "%x %X"]} } role_pretty { label "Role" @@ -175,10 +175,11 @@ } action_pretty { label "Action" + link_url_col action_url } } -db_multirow -extend { message } log select_log { +db_multirow -extend { action_url } log select_log { select l.entry_id, l.case_id, l.action_id, @@ -188,7 +189,15 @@ role.pretty_name as role_pretty, io.creation_user, iou.first_names || ' ' || iou.last_name as user_name, - to_char(io.creation_date, 'YYYY-HH-MM HH24:MI:SS') as creation_date_ansi + to_char(io.creation_date, 'YYYY-HH-MM HH24:MI:SS') as creation_date_ansi, + (select min(item_id) + from sim_messagesx + where entry_id = l.entry_id) as message_item_id, + (select min(name) + from sim_case_role_object_map, + cr_items + where entry_id = l.entry_id + and item_id = object_id) as document_name from workflow_case_log l join workflow_actions a using (action_id) join cr_items i on (i.item_id = l.entry_id) join @@ -201,6 +210,12 @@ and a.trigger_type = 'user' order by io.creation_date } { - + if { ![empty_string_p $message_item_id] } { + set action_url [export_vars -base message { case_id role_id { item_id $message_item_id } }] + } elseif { ![empty_string_p $document_name] } { + set action_url [simulation::object::content_url -name $document_name] + } else { + set action_url {} + } } Index: openacs-4/contrib/packages/simulation/www/simplay/task-detail.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/task-detail.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/contrib/packages/simulation/www/simplay/task-detail.tcl 30 Jan 2004 10:57:08 -0000 1.17 +++ openacs-4/contrib/packages/simulation/www/simplay/task-detail.tcl 30 Jan 2004 11:17:16 -0000 1.18 @@ -79,10 +79,10 @@ set body_mime_type [template::util::richtext::get_property "format" $body] db_transaction { - workflow::case::action::execute \ - -enabled_action_id $enabled_action_id \ - -comment $body_text \ - -comment_mime_type $body_mime_type + set entry_id [workflow::case::action::execute \ + -enabled_action_id $enabled_action_id \ + -comment $body_text \ + -comment_mime_type $body_mime_type] foreach recipient_id $action(recipients) { simulation::message::new \ @@ -92,7 +92,8 @@ -subject $subject \ -body $body_text \ -body_mime_type $body_mime_type \ - -attachments $attachments + -attachments $attachments \ + -entry_id $entry_id } } @@ -117,14 +118,14 @@ } -on_submit { db_transaction { - simulation::ui::forms::document_upload::insert_document \ - $case_id $role_id $item_id $document_file $title $description + set entry_id [workflow::case::action::execute \ + -case_id $case_id \ + -action_id $action_id \ + -comment "Document [lindex $document_file 0] uploaded" \ + -comment_mime_type "text/plain"] - workflow::case::action::execute \ - -case_id $case_id \ - -action_id $action_id \ - -comment "Document [lindex $document_file 0] uploaded" \ - -comment_mime_type "text/plain" + simulation::ui::forms::document_upload::insert_document \ + $case_id $role_id $item_id $document_file $title $description $entry_id } ad_returnredirect [export_vars -base tasks { case_id role_id }] 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.37 -r1.38 --- openacs-4/packages/simulation/lib/sim-template-tasks.tcl 26 Jan 2004 12:34:46 -0000 1.37 +++ openacs-4/packages/simulation/lib/sim-template-tasks.tcl 30 Jan 2004 11:17:16 -0000 1.38 @@ -248,9 +248,9 @@ } if { $counter > 1 } { - set up_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction up } { return_url [ad_return_url] } }] + set up_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction up } { return_url "[ad_return_url]\#tasks" } }] } - set down_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction down } { return_url [ad_return_url] } }] + set down_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction down } { return_url "[ad_return_url]\#tasks" } }] switch $trigger_type { workflow - parallel - dynamic { Index: openacs-4/packages/simulation/sql/postgresql/simulation-content-types-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/simulation-content-types-create.sql,v diff -u -r1.20 -r1.21 --- openacs-4/packages/simulation/sql/postgresql/simulation-content-types-create.sql 22 Jan 2004 14:08:39 -0000 1.20 +++ openacs-4/packages/simulation/sql/postgresql/simulation-content-types-create.sql 30 Jan 2004 11:17:16 -0000 1.21 @@ -306,6 +306,17 @@ 'integer' -- column_spec ); +select content_type__create_attribute( + 'sim_message', -- content_type + 'entry_id', -- attribute_name + 'integer', -- datatype + 'Entry ID', -- pretty_name + 'Entry IDs', -- pretty_plural + 4, -- sort_order + null, -- default_value + 'integer' -- column_spec +); + select content_type__register_relation_type ( 'sim_message', -- content_type 'sim_prop', -- target_type Index: openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql,v diff -u -r1.23 -r1.24 --- openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql 23 Jan 2004 11:16:15 -0000 1.23 +++ openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql 30 Jan 2004 11:17:16 -0000 1.24 @@ -163,6 +163,8 @@ on delete cascade, order_n integer, relation_tag varchar(100), + entry_id integer constraint scrom_case_log_fk + references workflow_case_log, constraint scrom_pk primary key (role_id, object_id, case_id, relation_tag) ); Index: openacs-4/packages/simulation/tcl/message-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/message-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/simulation/tcl/message-procs.tcl 26 Jan 2004 15:23:37 -0000 1.4 +++ openacs-4/packages/simulation/tcl/message-procs.tcl 30 Jan 2004 11:17:16 -0000 1.5 @@ -18,6 +18,7 @@ {-content_type "sim_message"} {-item_name ""} {-attachments ""} + {-entry_id {}} } { Create new simulation message. @@ -46,7 +47,8 @@ set attributes [list \ [list from_role_id $from_role_id] \ [list to_role_id $to_role_id] \ - [list case_id $case_id]] + [list case_id $case_id] \ + [list entry_id $entry_id]] set revision_id [bcms::revision::add_revision \ -item_id $item_id \ Index: openacs-4/packages/simulation/tcl/ui-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/ui-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/simulation/tcl/ui-procs.tcl 30 Jan 2004 10:57:08 -0000 1.3 +++ openacs-4/packages/simulation/tcl/ui-procs.tcl 30 Jan 2004 11:17:16 -0000 1.4 @@ -66,6 +66,7 @@ document_file title description + {entry_id {}} } { Does the document insertion in the DB. @@ -102,9 +103,9 @@ set relation_tag "portfolio" db_dml add_document_to_portfolio { insert into sim_case_role_object_map - (case_id, object_id, role_id, relation_tag) + (case_id, object_id, role_id, relation_tag, entry_id) values - (:case_id, :item_id, :role_id, :relation_tag) + (:case_id, :item_id, :role_id, :relation_tag, :entry_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.33 -r1.34 --- openacs-4/packages/simulation/www/simbuild/task-edit.tcl 26 Jan 2004 12:34:47 -0000 1.33 +++ openacs-4/packages/simulation/www/simbuild/task-edit.tcl 30 Jan 2004 11:17:16 -0000 1.34 @@ -128,11 +128,6 @@ {label "Task Name"} {html {size 50}} } - {pretty_past_tense:text,optional - {label "Task name in log"} - {html {size 50}} - {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'."} - } {trigger_type:text(radio) {label {[ad_decode $num_sub_actions 0 "Trigger Type" "Trigger Type
(Cannot edit because
task has child tasks)"]}} {mode {[ad_decode $num_sub_actions 0 "" "display"]}} @@ -269,7 +264,7 @@ set description [template::util::richtext::create $task_array(description) $task_array(description_mime_type)] foreach elm { - pretty_name pretty_past_tense new_state_id + pretty_name new_state_id assigned_role recipient_roles attachment_num trigger_type timeout_seconds parent_action_id } { @@ -312,10 +307,7 @@ } } - # Default pretty_past_tense - if { [empty_string_p $pretty_past_tense] } { - set pretty_past_tense $pretty_name - } + set pretty_past_tense $pretty_name foreach elm { pretty_name pretty_past_tense assigned_role description description_mime_type Index: openacs-4/packages/simulation/www/simplay/case-admin.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case-admin.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/simulation/www/simplay/case-admin.tcl 30 Jan 2004 10:29:16 -0000 1.12 +++ openacs-4/packages/simulation/www/simplay/case-admin.tcl 30 Jan 2004 11:17:16 -0000 1.13 @@ -164,7 +164,7 @@ -elements { timestamp { label "Time" - display_eval {[lc_time_fmt $creation_date_ansi "%X %x"]} + display_eval {[lc_time_fmt $creation_date_ansi "%x %X"]} } role_pretty { label "Role" @@ -175,10 +175,11 @@ } action_pretty { label "Action" + link_url_col action_url } } -db_multirow -extend { message } log select_log { +db_multirow -extend { action_url } log select_log { select l.entry_id, l.case_id, l.action_id, @@ -188,7 +189,15 @@ role.pretty_name as role_pretty, io.creation_user, iou.first_names || ' ' || iou.last_name as user_name, - to_char(io.creation_date, 'YYYY-HH-MM HH24:MI:SS') as creation_date_ansi + to_char(io.creation_date, 'YYYY-HH-MM HH24:MI:SS') as creation_date_ansi, + (select min(item_id) + from sim_messagesx + where entry_id = l.entry_id) as message_item_id, + (select min(name) + from sim_case_role_object_map, + cr_items + where entry_id = l.entry_id + and item_id = object_id) as document_name from workflow_case_log l join workflow_actions a using (action_id) join cr_items i on (i.item_id = l.entry_id) join @@ -201,6 +210,12 @@ and a.trigger_type = 'user' order by io.creation_date } { - + if { ![empty_string_p $message_item_id] } { + set action_url [export_vars -base message { case_id role_id { item_id $message_item_id } }] + } elseif { ![empty_string_p $document_name] } { + set action_url [simulation::object::content_url -name $document_name] + } else { + set action_url {} + } } Index: openacs-4/packages/simulation/www/simplay/task-detail.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/task-detail.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/packages/simulation/www/simplay/task-detail.tcl 30 Jan 2004 10:57:08 -0000 1.17 +++ openacs-4/packages/simulation/www/simplay/task-detail.tcl 30 Jan 2004 11:17:16 -0000 1.18 @@ -79,10 +79,10 @@ set body_mime_type [template::util::richtext::get_property "format" $body] db_transaction { - workflow::case::action::execute \ - -enabled_action_id $enabled_action_id \ - -comment $body_text \ - -comment_mime_type $body_mime_type + set entry_id [workflow::case::action::execute \ + -enabled_action_id $enabled_action_id \ + -comment $body_text \ + -comment_mime_type $body_mime_type] foreach recipient_id $action(recipients) { simulation::message::new \ @@ -92,7 +92,8 @@ -subject $subject \ -body $body_text \ -body_mime_type $body_mime_type \ - -attachments $attachments + -attachments $attachments \ + -entry_id $entry_id } } @@ -117,14 +118,14 @@ } -on_submit { db_transaction { - simulation::ui::forms::document_upload::insert_document \ - $case_id $role_id $item_id $document_file $title $description + set entry_id [workflow::case::action::execute \ + -case_id $case_id \ + -action_id $action_id \ + -comment "Document [lindex $document_file 0] uploaded" \ + -comment_mime_type "text/plain"] - workflow::case::action::execute \ - -case_id $case_id \ - -action_id $action_id \ - -comment "Document [lindex $document_file 0] uploaded" \ - -comment_mime_type "text/plain" + simulation::ui::forms::document_upload::insert_document \ + $case_id $role_id $item_id $document_file $title $description $entry_id } ad_returnredirect [export_vars -base tasks { case_id role_id }]