Index: openacs-4/contrib/packages/simulation/simulation.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/Attic/simulation.info,v diff -u -r1.12 -r1.13 --- openacs-4/contrib/packages/simulation/simulation.info 4 Mar 2004 16:23:18 -0000 1.12 +++ openacs-4/contrib/packages/simulation/simulation.info 15 Mar 2004 14:07:29 -0000 1.13 @@ -20,7 +20,7 @@ - + Index: openacs-4/contrib/packages/simulation/lib/case-history.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/case-history.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/simulation/lib/case-history.tcl 12 Mar 2004 15:49:43 -0000 1.2 +++ openacs-4/contrib/packages/simulation/lib/case-history.tcl 15 Mar 2004 14:07:02 -0000 1.3 @@ -25,7 +25,7 @@ } user_name { label "User" - link_url_eval {[acs_community_member_url -user_id $creation_user]} + link_url_eval {[ad_decode $creation_user "" "" [acs_community_member_url -user_id $creation_user]]} } action_pretty { label "Task" @@ -56,13 +56,11 @@ from workflow_case_log l join workflow_actions a using (action_id) join cr_items i on (i.item_id = l.entry_id) join - acs_objects io on (io.object_id = i.item_id) join - cc_users iou on (iou.user_id = io.creation_user) join - cr_revisions r on (r.revision_id = i.live_revision), - workflow_roles role + acs_objects io on (io.object_id = i.item_id) left outer join + acs_users_all iou on (iou.user_id = io.creation_user) join + cr_revisions r on (r.revision_id = i.live_revision) left outer join + workflow_roles role on (role.role_id = a.assigned_role) where l.case_id = :case_id - and role.role_id = a.assigned_role - and a.trigger_type = 'user' order by io.creation_date } { if { ![empty_string_p $message_item_id] } { @@ -72,6 +70,10 @@ } else { set action_url {} } + + if { [empty_string_p $creation_user] } { + set user_name "Timeout" + } } template::list::create \ Index: openacs-4/contrib/packages/simulation/tcl/template-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/template-procs.tcl,v diff -u -r1.66 -r1.67 --- openacs-4/contrib/packages/simulation/tcl/template-procs.tcl 4 Mar 2004 12:09:43 -0000 1.66 +++ openacs-4/contrib/packages/simulation/tcl/template-procs.tcl 15 Mar 2004 14:07:03 -0000 1.67 @@ -474,12 +474,13 @@ } } -ad_proc -public simulation::template::enroll_user { +ad_proc -public simulation::template::enroll_user { {-workflow_id:required} {-user_id:required} {-simulation_array ""} {-email ""} {-user_name ""} + {-admin:boolean} } { Enroll a user in a simulation. Sends out an email to the user for casting type open and group. Creates a SimPlay message notification for the user. @@ -525,22 +526,33 @@ -subject $subject\ -body $body } + + if { $admin_p } { + # Notify admin of all activity in the workflow. In particular this includes timed out tasks. + notification::request::new \ + -type_id [notification::type::get_type_id -short_name "workflow"] \ + -user_id $user_id \ + -object_id [ad_conn package_id] \ + -interval_id [notification::get_interval_id -name "instant"] \ + -delivery_method_id [notification::get_delivery_method_id -name "email"] + + } else { + # Sign up the user for email notification of received messages + notification::request::new \ + -type_id [notification::type::get_type_id -short_name [simulation::notification::message::type_short_name]] \ + -user_id $user_id \ + -object_id [ad_conn package_id] \ + -interval_id [notification::get_interval_id -name "instant"] \ + -delivery_method_id [notification::get_delivery_method_id -name "email"] - # Sign the user up for email notification of received messages - notification::request::new \ - -type_id [notification::type::get_type_id -short_name [simulation::notification::message::type_short_name]] \ - -user_id $user_id \ - -object_id [ad_conn package_id] \ - -interval_id [notification::get_interval_id -name "instant"] \ - -delivery_method_id [notification::get_delivery_method_id -name "email"] - - # Sign up the user for email notification of assigned tasks - notification::request::new \ - -type_id [notification::type::get_type_id -short_name "workflow_assignee"] \ - -user_id $user_id \ - -object_id [ad_conn package_id] \ - -interval_id [notification::get_interval_id -name "instant"] \ - -delivery_method_id [notification::get_delivery_method_id -name "email"] + # Sign up the user for email notification of assigned tasks + notification::request::new \ + -type_id [notification::type::get_type_id -short_name "workflow_assignee"] \ + -user_id $user_id \ + -object_id [ad_conn package_id] \ + -interval_id [notification::get_interval_id -name "instant"] \ + -delivery_method_id [notification::get_delivery_method_id -name "email"] + } } ad_proc -public simulation::template::enroll_and_invite_users { @@ -580,7 +592,13 @@ # Always enroll the admin creating the simulation set admin_user_id [ad_conn user_id] acs_user::get -user_id $admin_user_id -array admin_user - lappend enroll_user_list [list $admin_user_id $admin_user(email) $admin_user(name)] + simulation::template::enroll_user \ + -admin \ + -workflow_id $workflow_id \ + -user_id $admin_user_id \ + -simulation_array sim_template \ + -user_name $admin_user(name) \ + -email $admin_user(email) # Enroll users foreach user $enroll_user_list { @@ -982,8 +1000,6 @@ set row($role_short_name($role_id)) $assignees } - ns_log Notice "pm debug row = [array get row]" - # Do all the user-role assignments in the case workflow::case::role::assign \ -case_id $case_id \ Index: openacs-4/packages/simulation/simulation.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/simulation.info,v diff -u -r1.12 -r1.13 --- openacs-4/packages/simulation/simulation.info 4 Mar 2004 16:23:18 -0000 1.12 +++ openacs-4/packages/simulation/simulation.info 15 Mar 2004 14:07:29 -0000 1.13 @@ -20,7 +20,7 @@ - + Index: openacs-4/packages/simulation/lib/case-history.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/case-history.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/simulation/lib/case-history.tcl 12 Mar 2004 15:49:43 -0000 1.2 +++ openacs-4/packages/simulation/lib/case-history.tcl 15 Mar 2004 14:07:02 -0000 1.3 @@ -25,7 +25,7 @@ } user_name { label "User" - link_url_eval {[acs_community_member_url -user_id $creation_user]} + link_url_eval {[ad_decode $creation_user "" "" [acs_community_member_url -user_id $creation_user]]} } action_pretty { label "Task" @@ -56,13 +56,11 @@ from workflow_case_log l join workflow_actions a using (action_id) join cr_items i on (i.item_id = l.entry_id) join - acs_objects io on (io.object_id = i.item_id) join - cc_users iou on (iou.user_id = io.creation_user) join - cr_revisions r on (r.revision_id = i.live_revision), - workflow_roles role + acs_objects io on (io.object_id = i.item_id) left outer join + acs_users_all iou on (iou.user_id = io.creation_user) join + cr_revisions r on (r.revision_id = i.live_revision) left outer join + workflow_roles role on (role.role_id = a.assigned_role) where l.case_id = :case_id - and role.role_id = a.assigned_role - and a.trigger_type = 'user' order by io.creation_date } { if { ![empty_string_p $message_item_id] } { @@ -72,6 +70,10 @@ } else { set action_url {} } + + if { [empty_string_p $creation_user] } { + set user_name "Timeout" + } } template::list::create \ 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.66 -r1.67 --- openacs-4/packages/simulation/tcl/template-procs.tcl 4 Mar 2004 12:09:43 -0000 1.66 +++ openacs-4/packages/simulation/tcl/template-procs.tcl 15 Mar 2004 14:07:03 -0000 1.67 @@ -474,12 +474,13 @@ } } -ad_proc -public simulation::template::enroll_user { +ad_proc -public simulation::template::enroll_user { {-workflow_id:required} {-user_id:required} {-simulation_array ""} {-email ""} {-user_name ""} + {-admin:boolean} } { Enroll a user in a simulation. Sends out an email to the user for casting type open and group. Creates a SimPlay message notification for the user. @@ -525,22 +526,33 @@ -subject $subject\ -body $body } + + if { $admin_p } { + # Notify admin of all activity in the workflow. In particular this includes timed out tasks. + notification::request::new \ + -type_id [notification::type::get_type_id -short_name "workflow"] \ + -user_id $user_id \ + -object_id [ad_conn package_id] \ + -interval_id [notification::get_interval_id -name "instant"] \ + -delivery_method_id [notification::get_delivery_method_id -name "email"] + + } else { + # Sign up the user for email notification of received messages + notification::request::new \ + -type_id [notification::type::get_type_id -short_name [simulation::notification::message::type_short_name]] \ + -user_id $user_id \ + -object_id [ad_conn package_id] \ + -interval_id [notification::get_interval_id -name "instant"] \ + -delivery_method_id [notification::get_delivery_method_id -name "email"] - # Sign the user up for email notification of received messages - notification::request::new \ - -type_id [notification::type::get_type_id -short_name [simulation::notification::message::type_short_name]] \ - -user_id $user_id \ - -object_id [ad_conn package_id] \ - -interval_id [notification::get_interval_id -name "instant"] \ - -delivery_method_id [notification::get_delivery_method_id -name "email"] - - # Sign up the user for email notification of assigned tasks - notification::request::new \ - -type_id [notification::type::get_type_id -short_name "workflow_assignee"] \ - -user_id $user_id \ - -object_id [ad_conn package_id] \ - -interval_id [notification::get_interval_id -name "instant"] \ - -delivery_method_id [notification::get_delivery_method_id -name "email"] + # Sign up the user for email notification of assigned tasks + notification::request::new \ + -type_id [notification::type::get_type_id -short_name "workflow_assignee"] \ + -user_id $user_id \ + -object_id [ad_conn package_id] \ + -interval_id [notification::get_interval_id -name "instant"] \ + -delivery_method_id [notification::get_delivery_method_id -name "email"] + } } ad_proc -public simulation::template::enroll_and_invite_users { @@ -580,7 +592,13 @@ # Always enroll the admin creating the simulation set admin_user_id [ad_conn user_id] acs_user::get -user_id $admin_user_id -array admin_user - lappend enroll_user_list [list $admin_user_id $admin_user(email) $admin_user(name)] + simulation::template::enroll_user \ + -admin \ + -workflow_id $workflow_id \ + -user_id $admin_user_id \ + -simulation_array sim_template \ + -user_name $admin_user(name) \ + -email $admin_user(email) # Enroll users foreach user $enroll_user_list { @@ -982,8 +1000,6 @@ set row($role_short_name($role_id)) $assignees } - ns_log Notice "pm debug row = [array get row]" - # Do all the user-role assignments in the case workflow::case::role::assign \ -case_id $case_id \