Index: openacs-4/contrib/packages/simulation/lib/messages.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/messages.tcl,v
diff -u -r1.16.2.1 -r1.16.2.2
--- openacs-4/contrib/packages/simulation/lib/messages.tcl 17 Mar 2004 08:31:41 -0000 1.16.2.1
+++ openacs-4/contrib/packages/simulation/lib/messages.tcl 17 Mar 2004 09:15:07 -0000 1.16.2.2
@@ -116,33 +116,7 @@
sim_cases sc
where cr.revision_id = sm.message_id
and wc.case_id = sm.case_id
- [ad_decode $role_id "" "" "and (sm.entry_id is null or not (
- -- The whole expression in the not parenthesis is true if there is an assigned action
- -- responding to the message in which case the message shouldnt show up in the message list
-
- -- message is associated with an action that put us in the current state
- sm.entry_id in (select max(wcl.entry_id)
- from workflow_case_log wcl,
- workflow_fsm_actions wfa,
- workflow_case_fsm wcf,
- sim_messagesx sm2
- where wcl.case_id = sm.case_id
- and wcl.action_id = wfa.action_id
- and wcf.case_id = wcl.case_id
- and wfa.new_state = wcf.current_state
- and sm2.entry_id = wcl.entry_id
- and sm2.to_role_id = :role_id
- )
- and
- -- There is an assigned action with a recipient being sender of the message
- exists (select 1
- from workflow_case_assigned_actions wcaa,
- sim_task_recipients str
- where wcaa.case_id = sm.case_id
- and wcaa.role_id = :role_id
- and str.task_id = wcaa.action_id
- and str.recipient = sm.from_role_id)
- ))"]
+ [ad_decode $role_id "" "" "and [simulation::message::exclude_task_messages_sql]"]
[ad_decode $role_id "" "" "and (sm.to_role_id = :role_id or sm.from_role_id = :role_id)"]
and wc.case_id = sm.case_id
and sc.sim_case_id = wc.object_id
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.5 -r1.5.2.1
--- openacs-4/contrib/packages/simulation/tcl/message-procs.tcl 30 Jan 2004 11:17:16 -0000 1.5
+++ openacs-4/contrib/packages/simulation/tcl/message-procs.tcl 17 Mar 2004 09:15:08 -0000 1.5.2.1
@@ -108,3 +108,43 @@
return $item_id
}
+
+ad_proc -public simulation::message::exclude_task_messages_sql {} {
+ Return a SQL where clause that will exclude received messages that will
+ be responded to with an assigned task instead of by sending a message. The
+ need for this query arises because we don't want ask info type message to show up both in
+ the message list and the task list. Instead they should show up only in the task list.
+
+ The clause uses the bind variable role_id and assumes sm_messagesx to be in the from clause
+ aliased as sm.
+
+ @author Peter Marklund
+} {
+ return "(sm.entry_id is null or not (
+ -- The whole expression in the not parenthesis is true if there is an assigned action
+ -- responding to the message in which case the message shouldnt show up in the message list
+
+ -- message is associated with an action that put us in the current state
+ sm.entry_id in (select max(wcl.entry_id)
+ from workflow_case_log wcl,
+ workflow_fsm_actions wfa,
+ workflow_case_fsm wcf,
+ sim_messagesx sm2
+ where wcl.case_id = sm.case_id
+ and wcl.action_id = wfa.action_id
+ and wcf.case_id = wcl.case_id
+ and wfa.new_state = wcf.current_state
+ and sm2.entry_id = wcl.entry_id
+ and sm2.to_role_id = :role_id
+ )
+ and
+ -- There is an assigned action with a recipient being sender of the message
+ exists (select 1
+ from workflow_case_assigned_actions wcaa,
+ sim_task_recipients str
+ where wcaa.case_id = sm.case_id
+ and wcaa.role_id = :role_id
+ and str.task_id = wcaa.action_id
+ and str.recipient = sm.from_role_id)
+ ))"
+}
Index: openacs-4/contrib/packages/simulation/www/simplay/control-bar.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/control-bar.tcl,v
diff -u -r1.16 -r1.16.2.1
--- openacs-4/contrib/packages/simulation/www/simplay/control-bar.tcl 11 Mar 2004 12:44:53 -0000 1.16
+++ openacs-4/contrib/packages/simulation/www/simplay/control-bar.tcl 17 Mar 2004 09:15:09 -0000 1.16.2.1
@@ -24,12 +24,13 @@
set case_home_url [export_vars -base "case" { case_id role_id }]
-set message_count [db_string message_count_sql {
+set message_count [db_string message_count_sql "
select count(*)
- from sim_messages sm
- where sm.to_role_id = :role_id
+ from sim_messagesx sm
+ where (sm.to_role_id = :role_id or sm.from_role_id = :role_id)
and sm.case_id = :case_id
-}]
+ and [simulation::message::exclude_task_messages_sql]
+"]
set messages_url [export_vars -base ${section_uri}messages { case_id role_id }]
set task_count [db_string task_count_sql {
Index: openacs-4/contrib/packages/simulation/www/simplay/messages.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/messages.adp,v
diff -u -r1.13 -r1.13.2.1
--- openacs-4/contrib/packages/simulation/www/simplay/messages.adp 27 Jan 2004 09:58:43 -0000 1.13
+++ openacs-4/contrib/packages/simulation/www/simplay/messages.adp 17 Mar 2004 09:15:09 -0000 1.13.2.1
@@ -2,4 +2,4 @@
@title;noquote@
@context;noquote@
-
+
Index: openacs-4/packages/simulation/lib/messages.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/messages.tcl,v
diff -u -r1.16.2.1 -r1.16.2.2
--- openacs-4/packages/simulation/lib/messages.tcl 17 Mar 2004 08:31:41 -0000 1.16.2.1
+++ openacs-4/packages/simulation/lib/messages.tcl 17 Mar 2004 09:15:07 -0000 1.16.2.2
@@ -116,33 +116,7 @@
sim_cases sc
where cr.revision_id = sm.message_id
and wc.case_id = sm.case_id
- [ad_decode $role_id "" "" "and (sm.entry_id is null or not (
- -- The whole expression in the not parenthesis is true if there is an assigned action
- -- responding to the message in which case the message shouldnt show up in the message list
-
- -- message is associated with an action that put us in the current state
- sm.entry_id in (select max(wcl.entry_id)
- from workflow_case_log wcl,
- workflow_fsm_actions wfa,
- workflow_case_fsm wcf,
- sim_messagesx sm2
- where wcl.case_id = sm.case_id
- and wcl.action_id = wfa.action_id
- and wcf.case_id = wcl.case_id
- and wfa.new_state = wcf.current_state
- and sm2.entry_id = wcl.entry_id
- and sm2.to_role_id = :role_id
- )
- and
- -- There is an assigned action with a recipient being sender of the message
- exists (select 1
- from workflow_case_assigned_actions wcaa,
- sim_task_recipients str
- where wcaa.case_id = sm.case_id
- and wcaa.role_id = :role_id
- and str.task_id = wcaa.action_id
- and str.recipient = sm.from_role_id)
- ))"]
+ [ad_decode $role_id "" "" "and [simulation::message::exclude_task_messages_sql]"]
[ad_decode $role_id "" "" "and (sm.to_role_id = :role_id or sm.from_role_id = :role_id)"]
and wc.case_id = sm.case_id
and sc.sim_case_id = wc.object_id
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.5 -r1.5.2.1
--- openacs-4/packages/simulation/tcl/message-procs.tcl 30 Jan 2004 11:17:16 -0000 1.5
+++ openacs-4/packages/simulation/tcl/message-procs.tcl 17 Mar 2004 09:15:08 -0000 1.5.2.1
@@ -108,3 +108,43 @@
return $item_id
}
+
+ad_proc -public simulation::message::exclude_task_messages_sql {} {
+ Return a SQL where clause that will exclude received messages that will
+ be responded to with an assigned task instead of by sending a message. The
+ need for this query arises because we don't want ask info type message to show up both in
+ the message list and the task list. Instead they should show up only in the task list.
+
+ The clause uses the bind variable role_id and assumes sm_messagesx to be in the from clause
+ aliased as sm.
+
+ @author Peter Marklund
+} {
+ return "(sm.entry_id is null or not (
+ -- The whole expression in the not parenthesis is true if there is an assigned action
+ -- responding to the message in which case the message shouldnt show up in the message list
+
+ -- message is associated with an action that put us in the current state
+ sm.entry_id in (select max(wcl.entry_id)
+ from workflow_case_log wcl,
+ workflow_fsm_actions wfa,
+ workflow_case_fsm wcf,
+ sim_messagesx sm2
+ where wcl.case_id = sm.case_id
+ and wcl.action_id = wfa.action_id
+ and wcf.case_id = wcl.case_id
+ and wfa.new_state = wcf.current_state
+ and sm2.entry_id = wcl.entry_id
+ and sm2.to_role_id = :role_id
+ )
+ and
+ -- There is an assigned action with a recipient being sender of the message
+ exists (select 1
+ from workflow_case_assigned_actions wcaa,
+ sim_task_recipients str
+ where wcaa.case_id = sm.case_id
+ and wcaa.role_id = :role_id
+ and str.task_id = wcaa.action_id
+ and str.recipient = sm.from_role_id)
+ ))"
+}
Index: openacs-4/packages/simulation/www/simplay/control-bar.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/control-bar.tcl,v
diff -u -r1.16 -r1.16.2.1
--- openacs-4/packages/simulation/www/simplay/control-bar.tcl 11 Mar 2004 12:44:53 -0000 1.16
+++ openacs-4/packages/simulation/www/simplay/control-bar.tcl 17 Mar 2004 09:15:09 -0000 1.16.2.1
@@ -24,12 +24,13 @@
set case_home_url [export_vars -base "case" { case_id role_id }]
-set message_count [db_string message_count_sql {
+set message_count [db_string message_count_sql "
select count(*)
- from sim_messages sm
- where sm.to_role_id = :role_id
+ from sim_messagesx sm
+ where (sm.to_role_id = :role_id or sm.from_role_id = :role_id)
and sm.case_id = :case_id
-}]
+ and [simulation::message::exclude_task_messages_sql]
+"]
set messages_url [export_vars -base ${section_uri}messages { case_id role_id }]
set task_count [db_string task_count_sql {
Index: openacs-4/packages/simulation/www/simplay/messages.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/messages.adp,v
diff -u -r1.13 -r1.13.2.1
--- openacs-4/packages/simulation/www/simplay/messages.adp 27 Jan 2004 09:58:43 -0000 1.13
+++ openacs-4/packages/simulation/www/simplay/messages.adp 17 Mar 2004 09:15:09 -0000 1.13.2.1
@@ -2,4 +2,4 @@
@title;noquote@
@context;noquote@
-
+