Index: openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/project-procs.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl 30 Jun 2004 21:29:30 -0000 1.16 +++ openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl 1 Jul 2004 21:40:30 -0000 1.17 @@ -1658,6 +1658,7 @@ {-project_item_id:required} {-role_id:required} {-party_id:required} + {-send_email_p "t"} } { Assigns a user to a project @@ -1682,6 +1683,31 @@ (:project_item_id, :role_id, :party_id) } + if {[string is true $send_email_p]} { + + set project_name [pm::project::name \ + -project_item_id $project_item_id] + + set project_url [pm::project::url \ + -project_item_id $project_item_id] + + set to_addr [cc_email_from_party $party_id] + set from_addr [cc_email_from_party [ad_conn user_id]] + + set subject "Assigned to project: $project_name" + + set content "You have been assigned to a project: $project_name + +Link: $project_url" + + pm::util::email \ + -to_addr $to_addr \ + -from_addr $from_addr \ + -subject $subject \ + -body $content \ + -mime_type "text/plain" + } + return } @@ -1726,19 +1752,28 @@ @param project_item_id - @return + @return party_ids of all users removed from the project @error } { + set current_assignees [db_list get_assignees { + SELECT + party_id + FROM + pm_project_assignment + WHERE + project_id = :project_item_id + }] + db_dml remove_assignment { DELETE FROM pm_project_assignment WHERE project_id = :project_item_id } - return + return $current_assignees } @@ -1823,3 +1858,50 @@ }] } + + +ad_proc -public pm::project::name { + -project_item_id:required +} { + Returns the name for a project + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-07-01 + + @param project_item_id + + @return + + @error +} { + return [db_string get_name { + SELECT + title + FROM + cr_revisions p, + cr_items i + WHERE + i.live_revision = p.revision_id + and i.item_id = :project_item_id + } -default ""] +} + + +ad_proc -public pm::project::url { + -project_item_id:required +} { + Returns the URL for a project, when given the project_item_id + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-07-01 + + @param project_item_id + + @return + + @error +} { + + return "[ad_url][ad_conn package_url]one?project_item_id=$project_item_id" + +} Index: openacs-4/contrib/packages/project-manager/www/project-assign-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/project-assign-edit-2.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/project-manager/www/project-assign-edit-2.tcl 11 Jun 2004 20:58:19 -0000 1.1 +++ openacs-4/contrib/packages/project-manager/www/project-assign-edit-2.tcl 1 Jul 2004 21:40:30 -0000 1.2 @@ -20,16 +20,24 @@ set user_id [ad_maybe_redirect_for_registration] # remove assignments -pm::project::assign_remove_everyone -project_item_id $project_item_id +set current_assignees [pm::project::assign_remove_everyone \ + -project_item_id $project_item_id] foreach ass $assignee { regexp {(.*)-(.*)} $ass match party_id role_id + if {[lsearch $current_assignees $party_id] > -1} { + set send_email_p f + } else { + set send_email_p t + } + pm::project::assign \ -project_item_id $project_item_id \ -party_id $party_id \ - -role_id $role_id + -role_id $role_id \ + -send_email_p $send_email_p } Index: openacs-4/contrib/packages/project-manager/www/project-assign-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/project-assign-edit.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/project-manager/www/project-assign-edit.tcl 28 Jun 2004 21:12:22 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/project-assign-edit.tcl 1 Jul 2004 21:40:30 -0000 1.3 @@ -28,8 +28,10 @@ -package_id $subsite_id] +set project_name [pm::project::name -project_item_id $project_item_id] + set title "Edit project assignees" -set context [list "Edit assignees"] +set context [list [list "one?project_item_id=$project_item_id" "$project_name"] "Edit assignees"] set project_task_assignee_url [export_vars -base project-assign-task-assignees {project_item_id return_url}] Index: openacs-4/contrib/packages/project-manager/www/project-assign-task-assignees.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/project-assign-task-assignees.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/project-manager/www/project-assign-task-assignees.tcl 28 Jun 2004 21:12:22 -0000 1.1 +++ openacs-4/contrib/packages/project-manager/www/project-assign-task-assignees.tcl 1 Jul 2004 21:40:30 -0000 1.2 @@ -19,8 +19,8 @@ # remove all assignments -pm::project::assign_remove_everyone \ - -project_item_id $project_item_id +set current_assignees [pm::project::assign_remove_everyone \ + -project_item_id $project_item_id] # get all task assignments for this project @@ -42,7 +42,6 @@ foreach {party role} $pair { - # set the lowest role someone is assigned as if {[string is false [info exists lowest_role($party)]]} { set lowest_role($party) $role @@ -62,10 +61,18 @@ # make project assignments foreach party $parties { + + if {[lsearch $current_assignees $party] > -1} { + set send_email_p f + } else { + set send_email_p t + } + pm::project::assign \ -project_item_id $project_item_id \ -role_id $lowest_role($party) \ - -party_id $party + -party_id $party \ + -send_email_p $send_email_p } -ad_returnredirect -message "Set project assignments based on task assignments" [export_vars -base project-assign-edit {project_item_id return_url}] +ad_returnredirect -message "Saved project assignments based on task assignments" [export_vars -base project-assign-edit {project_item_id return_url}]