Index: openacs-4/packages/project-manager/project-manager.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/project-manager.info,v
diff -u -N -r1.48 -r1.49
--- openacs-4/packages/project-manager/project-manager.info 3 May 2006 18:20:37 -0000 1.48
+++ openacs-4/packages/project-manager/project-manager.info 22 May 2006 06:14:27 -0000 1.49
@@ -7,7 +7,7 @@
f
f
-
+
Jade Rubick
Malte Sussdorff
Project management tool for OpenACS
@@ -17,10 +17,11 @@
Track tasks, estimates and actual progress for a project. See the <a href="http://openacs.org/projects/dotwrk/project_management/">project page</a> for more information.
0
-
+
+
@@ -64,6 +65,7 @@
+
Index: openacs-4/packages/project-manager/tcl/project-manager-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/tcl/project-manager-procs.tcl,v
diff -u -N -r1.13 -r1.14
--- openacs-4/packages/project-manager/tcl/project-manager-procs.tcl 3 May 2006 18:29:19 -0000 1.13
+++ openacs-4/packages/project-manager/tcl/project-manager-procs.tcl 22 May 2006 06:14:27 -0000 1.14
@@ -329,6 +329,7 @@
{-peeraddr ""}
{-type "task"}
{-to ""}
+ {-to_party_ids ""}
{-send_email_p "f"}
} {
Adds a general comment to a task or project
@@ -354,6 +355,8 @@
@param to Emails of users to send the message.
+ @param to_party_ids List of party_ids to whom to send the email
+
@param send_email_p Whether or not to send out an email
notification t or f
@@ -443,75 +446,64 @@
if {[string equal $type task]} {
- set assignees $to
- if {[llength $assignees] > 0} {
+ set from_address [party::email -party_id $user_id]
+
+ set task_url [pm::task::get_url $object_id]
+
+ set subject "Task comment: $title"
+
+ # convert to HTML
+ set richtext_list [list $comment $mime_type]
+ set comment_html [template::util::richtext::get_property html_value $richtext_list]
+
+ set content "$title $comment_html"
+
+ set project_item_id [pm::task::project_item_id -task_item_id $object_id]
+
+ acs_mail_lite::complex_send \
+ -send_immediately \
+ -to_addr "$to" \
+ -to_party_ids "$to_party_ids" \
+ -from_addr "$from_address" \
+ -subject "$subject" \
+ -body $content \
+ -mime_type "text/html" \
+ -object_id "$project_item_id" \
+ -use_sender \
+ -no_callback \
+ -single_email
+ }
- set from_address [db_string get_from_email "select email from parties where party_id = :user_id" -default "nobody@nowhere.com"]
-
- set task_url [pm::task::get_url $object_id]
-
- set subject "Task comment: $title"
-
- # convert to HTML
- set richtext_list [list $comment $mime_type]
- set comment_html [template::util::richtext::get_property html_value $richtext_list]
-
- set content "$title $comment_html"
-
- set project_item_id [pm::task::project_item_id -task_item_id $object_id]
-
- foreach to_address $assignees {
- acs_mail_lite::complex_send \
- -send_immediately \
- -to_addr "$to_address" \
- -from_addr "$from_address" \
- -subject "$subject" \
- -body $content \
- -mime_type "text/html" \
- -object_id "$project_item_id" \
- -use_sender \
- -no_callback
- }
- }
-
- }
-
# project
if {[string equal $type project]} {
- set assignees $to
- if {[llength $assignees] > 0} {
-
- set from_address [db_string get_from_email "select email from parties where party_id = :user_id" -default "nobody@nowhere.com"]
-
- set project_url [pm::project::url \
- -project_item_id $object_id]
-
- set subject "[_ project-manager.lt_Project_comment_title]"
-
- # convert to HTML
- set richtext_list [list $comment $mime_type]
- set comment_html [template::util::richtext::get_property html_value $richtext_list]
-
- set content "$title $comment_html"
-
-
- foreach to_address $assignees {
- acs_mail_lite::complex_send \
- -send_immediately \
- -to_addr "$to_address" \
- -from_addr "$from_address" \
- -subject "$subject" \
- -body $content \
- -mime_type "text/html" \
- -object_id "$object_id" \
- -no_callback \
- -use_sender
- }
-
- }
-
+ set from_address [db_string get_from_email "select email from parties where party_id = :user_id" -default "nobody@nowhere.com"]
+
+ set project_url [pm::project::url \
+ -project_item_id $object_id]
+
+ set subject "[_ project-manager.lt_Project_comment_title]"
+
+ # convert to HTML
+ set richtext_list [list $comment $mime_type]
+ set comment_html [template::util::richtext::get_property html_value $richtext_list]
+
+ set content "$title $comment_html"
+
+
+ acs_mail_lite::complex_send \
+ -send_immediately \
+ -to_addr "$to" \
+ -to_party_ids "$to_party_ids" \
+ -from_addr "$from_address" \
+ -subject "$subject" \
+ -body $content \
+ -mime_type "text/html" \
+ -object_id "$object_id" \
+ -no_callback \
+ -single_email \
+ -use_sender
}
}
Index: openacs-4/packages/project-manager/www/comments/add.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/comments/add.tcl,v
diff -u -N -r1.9 -r1.10
--- openacs-4/packages/project-manager/www/comments/add.tcl 10 May 2006 18:51:42 -0000 1.9
+++ openacs-4/packages/project-manager/www/comments/add.tcl 22 May 2006 06:14:27 -0000 1.10
@@ -48,36 +48,38 @@
# to see if it is an observer.
if { [string equal [lsearch $observer_role_id [lindex $assignee 1]] "-1"]} {
# Not an observer. Added to the list
- set name [person::name -person_id [lindex $assignee 0]]
- set email [party::email -party_id [lindex $assignee 0]]
+ set party_id [lindex $assignee 0]
+ set name [person::name -party_id $party_id]
+ set email [party::email -party_id $party_id]
if {$show_role_p} {
# display assigned role
- lappend assignee_list [list "$name ($email) ([pm::role::name -role_id [lindex $assignee 1]])" $email]
+ lappend assignee_list [list "$name ($email) ([pm::role::name -role_id [lindex $assignee 1]])" $party_id]
} else {
- lappend assignee_list [list "$name ($email)" $email]
+ lappend assignee_list [list "$name ($email)" $party_id]
}
}
}
} else {
# We want every assignee so we just get the assignees name
foreach assignee $assignees {
- set name [person::name -person_id [lindex $assignee 0]]
- set email [party::email -party_id [lindex $assignee 0]]
+ set party_id [lindex $assignee 0]
+ set name [person::name -party_id $party_id]
+ set email [party::email -party_id $party_id]
if {$show_role_p} {
# display assigned role
- lappend assignee_list [list "$name ($email) ([pm::role::name -role_id [lindex $assignee 1]])" $email]
+ lappend assignee_list [list "$name ($email) ([pm::role::name -role_id [lindex $assignee 1]])" $party_id]
} else {
- lappend assignee_list [list "$name ($email)" $email]
+ lappend assignee_list [list "$name ($email)" $party_id]
}
}
}
-set listed_emails {}
+set listed_party_ids {}
foreach assignee $assignee_list {
- lappend listed_emails [lindex $assignee 1]
+ lappend listed_party_ids [lindex $assignee 1]
}
@@ -89,26 +91,14 @@
set name [person::name -person_id [lindex $assignee 0]]
set email [party::email -party_id [lindex $assignee 0]]
- if {[lsearch -exact $listed_emails $email] == -1} {
+ if {[lsearch -exact $listed_party_ids $email] == -1} {
lappend assignee_list [list "$name ($email)" $email]
- lappend listed_emails $email
+ lappend listed_party_ids $email
}
}
}
}
-
-set employee_list [group::get_members -group_id [group::get_id -group_name "Employees"]]
-foreach employee_id $employee_list {
- set name [person::name -person_id $employee_id]
- set email [party::email -party_id $employee_id]
-
- if {[lsearch -exact $listed_emails $email] == -1} {
- lappend assignee_list [list "$name ($email)" $email]
- lappend listed_emails $email
- }
-}
-
ad_form -name comment \
-form {
acs_object_id_seq:key
@@ -135,61 +125,45 @@
{html { rows 9 cols 40 wrap soft}}}
}
-# We will add a check/uncheck element to call the javascript function,
-# this works only when the elements in the list is greather than one
-set default_checked_p 0
+ad_form -extend -name comment -form {
+ {assignee:text(checkbox),multiple,optional
+ {label "[_ project-manager.Send_email]"}
+ {section "[_ project-manager.Assignees]" }
+ {options $assignee_list}
+ }
+}
+
-if {$default_checked_p} {
- if { [llength $assignee_list] > 1 } {
- ad_form -extend -name comment -form {
- {check_uncheck:text(checkbox),multiple,optional
- {label "[_ project-manager.check_uncheck]"}
- {options {{"" 1}}}
- {value 1}
- {section "[_ project-manager.Email]" }
- {html {onclick check_uncheck_boxes(this.checked)}}
+foreach group [split [parameter::get -parameter "CommentGroups"] ";"] {
+ set group_id [group::get_id -group_name "$group"]
+ set group_title [group::title -group_name $group]
+ if {![string eq $group_id ""]} {
+
+ set member_list [group::get_members -group_id $group_id]
+ set assignee_list [list [list $group_title $group_id]]
+
+ foreach member_id $member_list {
+ set name [contact::name -party_id $member_id]
+ set email [party::email -party_id $member_id]
+
+ if {[lsearch -exact $listed_party_ids $member_id] == -1} {
+ lappend assignee_list [list "$name ($email)" $member_id]
+ lappend listed_party_ids $member_id
}
- {to:text(checkbox),optional,multiple
- {label "[_ project-manager.Send_email]"}
- {options $assignee_list}
- {html {checked 1}}
+ }
+
+ if {[llength $assignee_list] > 0} {
+ ad_form -extend -name comment -form {
+ {${group_id}:text(checkbox),multiple,optional
+ {label "[_ project-manager.Send_email]"}
+ {section "$group_title" }
+ {options $assignee_list}
+ }
}
}
- } else {
- ad_form -extend -name comment -form {
- {to:text(checkbox),optional
- {label "[_ project-manager.Send_email]"}
- {section "[_ project-manager.Email]" }
- {options $assignee_list}
- {html {checked 1}}
- }
- }
}
-} else {
- if { [llength $assignee_list] > 1 } {
- ad_form -extend -name comment -form {
- {check_uncheck:text(checkbox),multiple,optional
- {label "[_ project-manager.check_uncheck]"}
- {options {{"" 1}}}
- {section "[_ project-manager.Email]" }
- {html {onclick check_uncheck_boxes(this.checked)}}
- }
- {to:text(checkbox),optional,multiple
- {label "[_ project-manager.Send_email]"}
- {options $assignee_list}
- }
- }
- } else {
- ad_form -extend -name comment -form {
- {to:text(checkbox),optional
- {label "[_ project-manager.Send_email]"}
- {section "[_ project-manager.Email]" }
- {options $assignee_list}
- }
- }
- }
}
-
+
ad_form -extend -name comment -form {
{attach_p:text(select),optional
{label "[_ project-manager.Attach_a_file]"}
@@ -205,14 +179,22 @@
# insert the comment into the database
set description_body [template::util::richtext::get_property contents $description]
set description_format [template::util::richtext::get_property format $description]
+
+ set to_party_ids $assignee
+ foreach group [split [parameter::get -parameter "CommentGroups"] ";"] {
+ set group_id [group::get_id -group_name "$group"]
+ foreach assignee_id [set $group_id] {
+ lappend to_party_ids "$assignee_id"
+ }
+ }
set comment_id [pm::util::general_comment_add \
-object_id $object_id \
-title "$title" \
-comment "$description_body" \
-mime_type "$description_format" \
-send_email_p "t" \
- -to "$to" \
+ -to_party_ids "$to_party_ids" \
-type $type]
# does not seem to be working for some reason