Index: openacs-4/contrib/packages/project-manager/tcl/task-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/task-procs.tcl,v diff -u -r1.4.2.18 -r1.4.2.19 --- openacs-4/contrib/packages/project-manager/tcl/task-procs.tcl 10 Sep 2004 16:58:57 -0000 1.4.2.18 +++ openacs-4/contrib/packages/project-manager/tcl/task-procs.tcl 15 Sep 2004 23:05:51 -0000 1.4.2.19 @@ -631,9 +631,9 @@ } { # set package_id [db_string get_package_id {}] # set package_url [site_node::get_url_from_object_id -object_id $package_id] - # set package_url [site_node::get_url_from_object_id -object_id $object_id] + set package_url [site_node::get_url_from_object_id -object_id $object_id] #return "${package_url}task-one?task_id=$object_id" - return {} + return $package_url # "/project-manager/task-one?task_id=$object_id" } @@ -1184,7 +1184,7 @@ set send_email_p [parameter::get_from_package_key -package_key "project-manager" -parameter SendDailyEmail -default "0"] - if {[string equal $send_email_p "0"]} { + if {[string is false $send_email_p]} { ns_log Notice "Parameter SendDailyEmail for project manager says skip email today" return } @@ -1201,7 +1201,7 @@ # what if the person assigned is no longer a part of the subsite? # right now, we still email them. - db_foreach get_all_open_tasks " + db_foreach get_all_open_tasks { SELECT ts.task_id, ts.task_id as item_id, @@ -1242,46 +1242,45 @@ t.item_id = ta.task_id and ta.party_id = p.party_id ORDER BY - t.latest_start asc" { - set earliest_start_pretty [lc_time_fmt $earliest_start "%x"] - set earliest_finish_pretty [lc_time_fmt $earliest_finish "%x"] - set latest_start_pretty [lc_time_fmt $latest_start "%x"] - set latest_finish_pretty [lc_time_fmt $latest_finish "%x"] + t.latest_start asc + } { + set earliest_start_pretty [lc_time_fmt $earliest_start "%x"] + set earliest_finish_pretty [lc_time_fmt $earliest_finish "%x"] + set latest_start_pretty [lc_time_fmt $latest_start "%x"] + set latest_finish_pretty [lc_time_fmt $latest_finish "%x"] + + if {[exists_and_not_null earliest_start_j]} { + set slack_time [pm::task::slack_time \ + -earliest_start_j $earliest_start_j \ + -today_j $today_j \ + -latest_start_j $latest_start_j] - if {[exists_and_not_null earliest_start_j]} { - set slack_time [pm::task::slack_time \ - -earliest_start_j $earliest_start_j \ - -today_j $today_j \ - -latest_start_j $latest_start_j] - - } - - if {[lsearch $parties $party_id] == -1} { - lappend parties $party_id - } - - lappend task_list($party_id) $task_id - set titles_arr($task_id) $title - set ls_arr($task_id) $latest_start_pretty - set lf_arr($task_id) $latest_finish_pretty - set slack_arr($task_id) $slack_time - - # how many tasks does this person have? - if {[info exists task_count($party_id)]} { - incr task_count($party_id) - } else { - set task_count($party_id) 1 - } } + + if {[lsearch $parties $party_id] == -1} { + lappend parties $party_id + } + + lappend task_list($party_id) $task_id + set titles_arr($task_id) $title + set ls_arr($task_id) $latest_start_pretty + set lf_arr($task_id) $latest_finish_pretty + set slack_arr($task_id) $slack_time + set roles($task_id-$party_id) $role + + # how many tasks does this person have? + if {[info exists task_count($party_id)]} { + incr task_count($party_id) + } else { + set task_count($party_id) 1 + } + } # transitions are < this value set OVERDUE_THRESHOLD 0 set PRESSING_THRESHOLD 7 set LONGTERM_THRESHOLD 90 - set TASK_LENGTH 70 - set TASK_ID_LENGTH 9 - foreach party $parties { set subject "Daily Task status report" @@ -1293,6 +1292,8 @@ foreach task $task_list($party) { + set url [pm::task::get_url $task] + if {$slack_arr($task) < $OVERDUE_THRESHOLD} { set which_pile overdue } elseif {$slack_arr($task) < $PRESSING_THRESHOLD} { @@ -1305,88 +1306,110 @@ if {![empty_string_p $which_pile]} { - set trimmed_task [pm::util::string_truncate_and_pad -length $TASK_ID_LENGTH -string $task] - set trimmed_title [pm::util::string_truncate_and_pad -length $TASK_LENGTH -string $titles_arr($task)] + lappend $which_pile " +\#$task$titles_arr($task)$roles($task-$party)$ls_arr($task)$lf_arr($task)$slack_arr($task)" - lappend $which_pile "$trimmed_task $trimmed_title" - lappend $which_pile "[string repeat " " $TASK_ID_LENGTH] LS: $ls_arr($task) LF: $lf_arr($task) Slack: $slack_arr($task)" - lappend $which_pile "" } } - set description [list] + set overdue_title "

Overdue Tasks

" - set overdue_title "OVERDUE TASKS" - set overdue_title [pm::util::string_truncate_and_pad -length $TASK_LENGTH -string $overdue_title] - set overdue_description "consult with people affected, and let them know deadlines are affected" - set pressing_title "PRESSING TASKS" - set pressing_title [pm::util::string_truncate_and_pad -length $TASK_LENGTH -string $pressing_title] + set pressing_title "

Pressing Tasks

" set pressing_description "you need to start working on these soon to avoid affecting deadlines" - set longterm_title "LONG TERM TASKS" - set longterm_title [pm::util::string_truncate_and_pad -length $TASK_LENGTH -string $longterm_title] + set longterm_title "

Long Term Tasks

" + set longterm_description "look over these to plan ahead" # okay, let's now set up the email body - lappend description "This is a daily reminder of tasks that are assigned to you" - lappend description "You current have $task_count($party) tasks assigned to you" + set description " +

This is a daily reminder of tasks that are assigned to you +You currently have $task_count($party) tasks assigned to you

- lappend description "" - lappend description "\# $overdue_title" +$overdue_title - set length [string length $overdue_description] - lappend description [string repeat "_" $length] +
- lappend description $overdue_description +$overdue_description - lappend description "" + + + + + + + + + +" + foreach overdue_item $overdue { - lappend description $overdue_item + append description $overdue_item } - lappend description "" - lappend description "\# $pressing_title" + append description " +
Task \#SubjectRoleLatest startLatest finishSlack
- set length [string length $pressing_description] - lappend description [string repeat "_" $length] +$pressing_title - lappend description $pressing_description +
+$pressing_description - lappend description "" + + + + + + + + + +" + foreach pressing_item $pressing { - lappend description $pressing_item + append description $pressing_item } - lappend description "" - lappend description "\# $longterm_title" + append description " +
Task \#SubjectRoleLatest startLatest finishSlack
- set length [string length $longterm_description] - lappend description [string repeat "_" $length] +$longterm_title - lappend description $longterm_description +$longterm_description - lappend description "" + + + + + + + + + +" + foreach longterm_item $longterm { - lappend description $longterm_item + append description $longterm_item } + append description "
Task \#SubjectRoleLatest startLatest finishSlack
" + pm::util::email \ -to_addr $address \ -from_addr $address \ -subject $subject \ - -body [join $description "\n"] \ - -mime_type "text/plain" - + -body $description \ + -mime_type "text/html" } - # consider also sending out emails to people who have assigned - # tickets to nobody + # consider also sending out emails to people who have created + # tickets that are not assigned to anyone }