Index: openacs-4/contrib/packages/project-manager/project-manager.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/Attic/project-manager.info,v diff -u -r1.16 -r1.17 --- openacs-4/contrib/packages/project-manager/project-manager.info 12 Mar 2004 13:44:41 -0000 1.16 +++ openacs-4/contrib/packages/project-manager/project-manager.info 27 Apr 2004 00:49:26 -0000 1.17 @@ -6,15 +6,15 @@ Project Managers f f - project-manager - - + + Jade Rubick Project management tool for OpenACS - 2004-03-05 + 2004-04-26 + Integrated Bakery Resources 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. - + @@ -30,6 +30,7 @@ + Index: openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-custom-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/sql/postgresql/Attic/project-manager-custom-drop.sql,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-custom-drop.sql 26 Feb 2004 15:15:40 -0000 1.3 +++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-custom-drop.sql 27 Apr 2004 00:49:27 -0000 1.4 @@ -9,3 +9,4 @@ -- drop any custom tables here. select content_type__drop_attribute ('pm_project', 'customer_id', 't'); + Index: openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/sql/postgresql/Attic/project-manager-functions-create.sql,v diff -u -r1.13 -r1.14 --- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql 12 Mar 2004 13:44:42 -0000 1.13 +++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql 27 Apr 2004 00:49:27 -0000 1.14 @@ -19,7 +19,7 @@ returns varchar as ' declare p_pm_project_id alias for $1; - v_pm_project_name varchar; + v_pm_project_name pm_projects.project_name%TYPE; begin select project_name || ''_'' || p_pm_project_id into v_pm_project_name from pm_projectsx @@ -130,14 +130,15 @@ -- is null. Otherwise a project folder will be created as a sub-folder -- of an existing project folder. -select define_function_args('pm_project__new_project_item', 'project_name, project_code, parent_id, goal, description, planned_start_date, planned_end_date, actual_start_date, actual_end_date, logger_project, ongoing_p, status_id, customer_id, creation_date, creation_user, creation_ip, package_id'); +select define_function_args('pm_project__new_project_item', 'project_name, project_code, parent_id, goal, description, mime_type, planned_start_date, planned_end_date, actual_start_date, actual_end_date, logger_project, ongoing_p, status_id, customer_id, creation_date, creation_user, creation_ip, package_id'); create or replace function pm_project__new_project_item ( varchar, -- project_name varchar, -- project_code integer, -- parent_id varchar, -- goal varchar, -- description + varchar, -- mime_type timestamptz, -- planned_start_date timestamptz, -- planned_end_date timestamptz, -- actual_start_date @@ -158,18 +159,19 @@ p_parent_id alias for $3; p_goal alias for $4; p_description alias for $5; - p_planned_start_date alias for $6; - p_planned_end_date alias for $7; - p_actual_start_date alias for $8; - p_actual_end_date alias for $9; - p_logger_project alias for $10; - p_ongoing_p alias for $11; - p_status_id alias for $12; - p_customer_id alias for $13; - p_creation_date alias for $14; - p_creation_user alias for $15; - p_creation_ip alias for $16; - p_package_id alias for $17; + p_mime_type alias for $6; + p_planned_start_date alias for $7; + p_planned_end_date alias for $8; + p_actual_start_date alias for $9; + p_actual_end_date alias for $10; + p_logger_project alias for $11; + p_ongoing_p alias for $12; + p_status_id alias for $13; + p_customer_id alias for $14; + p_creation_date alias for $15; + p_creation_user alias for $16; + p_creation_ip alias for $17; + p_package_id alias for $18; v_item_id cr_items.item_id%TYPE; v_revision_id cr_revisions.revision_id%TYPE; @@ -202,7 +204,7 @@ ''pm_project'', -- content_type p_project_name, -- title p_description, -- description - ''text/plain'', -- mime_type + p_mime_type, -- mime_type null, -- nls_language null -- data ); @@ -211,7 +213,7 @@ p_project_name, -- title p_description, -- description now(), -- publish_date - ''text/plain'', -- mime_type + p_mime_type, -- mime_type NULL, -- nls_language NULL, -- data v_item_id, -- item_id @@ -427,12 +429,13 @@ -- If it is not associated with a project, then it is placed in the root -- project repository folder. -select define_function_args('pm_task__new_task_item', 'project_id, title, description, end_date, percent_complete, estimated_hours_work, estimated_hours_work_min, estimated_hours_work_max, status_id, creation_date, creation_user, creation_ip, package_id'); +select define_function_args('pm_task__new_task_item', 'project_id, title, description, html_p, end_date, percent_complete, estimated_hours_work, estimated_hours_work_min, estimated_hours_work_max, status_id, creation_date, creation_user, creation_ip, package_id'); create function pm_task__new_task_item ( integer, -- project_id varchar, -- title varchar, -- description + varchar, -- html_p timestamptz, -- end_date numeric, -- percent_complete numeric, -- estimated_hours_work @@ -449,16 +452,17 @@ p_project_id alias for $1; p_title alias for $2; p_description alias for $3; - p_end_date alias for $4; - p_percent_complete alias for $5; - p_estimated_hours_work alias for $6; - p_estimated_hours_work_min alias for $7; - p_estimated_hours_work_max alias for $8; - p_status_id alias for $9; - p_creation_date alias for $10; - p_creation_user alias for $11; - p_creation_ip alias for $12; - p_package_id alias for $13; + p_mime_type alias for $4; + p_end_date alias for $5; + p_percent_complete alias for $6; + p_estimated_hours_work alias for $7; + p_estimated_hours_work_min alias for $8; + p_estimated_hours_work_max alias for $9; + p_status_id alias for $10; + p_creation_date alias for $11; + p_creation_user alias for $12; + p_creation_ip alias for $13; + p_package_id alias for $14; v_item_id cr_items.item_id%TYPE; v_revision_id cr_revisions.revision_id%TYPE; @@ -484,7 +488,7 @@ ''pm_task'', -- content_type p_title, -- title p_description, -- description - ''text/plain'', -- mime_type + p_mime_type, -- mime_type null, -- nls_language null -- data ); @@ -493,7 +497,7 @@ p_title, -- title p_description, -- description now(), -- publish_date - ''text/plain'', -- mime_type + p_mime_type, -- mime_type NULL, -- nls_language NULL, -- data v_item_id, -- item_id @@ -525,13 +529,14 @@ end;' language 'plpgsql'; -select define_function_args('pm_task__new_task_revision', 'task_id, project_id, title, description, end_date, percent_complete, estimated_hours_work, estimated_hours_work_min, estimated_hours_work_max, actual_hours_worked, creation_date, creation_user, creation_ip, package_id'); +select define_function_args('pm_task__new_task_revision', 'task_id, project_id, title, description, mime_type, end_date, percent_complete, estimated_hours_work, estimated_hours_work_min, estimated_hours_work_max, actual_hours_worked, creation_date, creation_user, creation_ip, package_id'); create function pm_task__new_task_revision ( integer, -- task_id (the item_id) integer, -- project_id varchar, -- title varchar, -- description + varchar, -- mime_type timestamptz, -- end_date numeric, -- percent_complete numeric, -- estimated_hours_work @@ -550,18 +555,18 @@ p_project_id alias for $2; p_title alias for $3; p_description alias for $4; - p_end_date alias for $5; - p_percent_complete alias for $6; - p_estimated_hours_work alias for $7; - p_estimated_hours_work_min alias for $8; - p_estimated_hours_work_max alias for $9; - p_actual_hours_worked alias for $10; - p_status_id alias for $11; - p_creation_date alias for $12; - p_creation_user alias for $13; - p_creation_ip alias for $14; - p_package_id alias for $15; - + p_mime_type alias for $5; + p_end_date alias for $6; + p_percent_complete alias for $7; + p_estimated_hours_work alias for $8; + p_estimated_hours_work_min alias for $9; + p_estimated_hours_work_max alias for $10; + p_actual_hours_worked alias for $11; + p_status_id alias for $12; + p_creation_date alias for $13; + p_creation_user alias for $14; + p_creation_ip alias for $15; + p_package_id alias for $16; v_revision_id cr_revisions.revision_id%TYPE; v_id cr_items.item_id%TYPE; begin @@ -573,7 +578,7 @@ p_title, -- title p_description, -- description now(), -- publish_date - ''text/plain'', -- mime_type + p_mime_type, -- mime_type NULL, -- nls_language NULL, -- data p_task_id, -- item_id Index: openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-table-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/sql/postgresql/Attic/project-manager-table-create.sql,v diff -u -r1.19 -r1.20 --- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-table-create.sql 12 Mar 2004 13:44:42 -0000 1.19 +++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-table-create.sql 27 Apr 2004 00:49:27 -0000 1.20 @@ -135,7 +135,7 @@ create table pm_project_assignment ( project_id integer constraint pm_proj_role_map_project_fk - references pm_projects + references cr_items on delete cascade, role_id integer constraint pm_project_role_map_role_fk Index: openacs-4/contrib/packages/project-manager/tcl/notification-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/notification-init.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/tcl/notification-init.tcl 27 Apr 2004 00:49:28 -0000 1.1 @@ -0,0 +1,14 @@ +# + +ad_library { + + Init file to schedul registered procedures for notifications + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-04-14 + @arch-tag: e72c34cc-2ed9-42c5-8423-d9b349f0e6c4 + @cvs-id $Id: notification-init.tcl,v 1.1 2004/04/27 00:49:28 jader Exp $ +} + +# set up daily emailings +pm::task::email_status_init Index: openacs-4/contrib/packages/project-manager/tcl/project-manager-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/project-manager-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/project-manager/tcl/project-manager-procs.tcl 12 Mar 2004 13:44:43 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/tcl/project-manager-procs.tcl 27 Apr 2004 00:49:28 -0000 1.3 @@ -20,9 +20,42 @@ } { Extended nvl, for dates only } { - if { [string equal $value "{} {} {} {} {} {}"]} { + if {[string equal $value "{} {} {} {} {} {}"] \ + || [empty_string_p $value]} { return $value_if_null } else { return $value_if_not_null } } + + +ad_proc -public pm::util::string_truncate_and_pad { + -length + {-ellipsis "..."} + -string +} { + Truncates a string to a given length, or pads it to match a given length + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-04-14 + + @param length + + @param ellipsis + + @param string + + @return + + @error +} { + + set new_string [string_truncate -len $length -ellipsis $ellipsis -- $string] + set new_string_length [string length $new_string] + + if {$new_string_length < $length} { + set new_string "$new_string[string repeat " " [expr $length - $new_string_length]]" + } + + return $new_string +} Index: openacs-4/contrib/packages/project-manager/tcl/project-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/project-procs-postgresql.xql,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/project-manager/tcl/project-procs-postgresql.xql 12 Mar 2004 13:44:43 -0000 1.4 +++ openacs-4/contrib/packages/project-manager/tcl/project-procs-postgresql.xql 27 Apr 2004 00:49:28 -0000 1.5 @@ -53,6 +53,7 @@ :parent_id, :goal, :description, + :mime_type, to_timestamp(:planned_start_date,'YYYY MM DD HH24 MI SS'), to_timestamp(:planned_end_date,'YYYY MM DD HH24 MI SS'), null, @@ -101,12 +102,22 @@ else t.actual_hours_worked end as worked, t.estimated_hours_work as to_work, t.item_id as my_iid, - to_char(end_date,'J') as task_deadline_j + to_char(end_date,'J') as task_deadline_j, + to_char(earliest_start,'J') as old_earliest_start_j, + to_char(earliest_finish,'J') as old_earliest_finish_j, + to_char(latest_start,'J') as old_latest_start_j, + to_char(latest_finish,'J') as old_latest_finish_j, + s.status_type from - pm_tasks_revisionsx t, cr_items i + pm_tasks_revisionsx t, + cr_items i, + pm_tasks ti, + pm_task_status s where t.item_id in ([join $task_list ", "]) and - i.live_revision = t.revision_id + i.live_revision = t.revision_id and + i.item_id = ti.task_id and + ti.status = s.status_id 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.7 -r1.8 --- openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl 20 Apr 2004 21:12:20 -0000 1.7 +++ openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl 27 Apr 2004 00:49:28 -0000 1.8 @@ -86,13 +86,17 @@ {-task_item_id ""} {-project_item_id ""} {-update_status_p "t"} + {-party_id ""} } { Adds a logger entry to a project. If task_item_id is passed in, also links it up with that task, and updates the task hours. - + @author Jade Rubick (jader@bread.com) @creation-date 2004-03-05 + + @see logger::entry::new + @see pm::project::compute_status @param entry_id If passed in, determines the entry_id for the newly logged entry @@ -117,6 +121,9 @@ This can be set to f when editing a task, because these things are done later anyway. + @param party_id If set, the party that creates the new logger + entry. If not set, defaults to ad_conn user_id + @return 0 if there no task it is logged against, otherwise returns the total number of hours logged to that task @@ -132,13 +139,20 @@ set entry_id [db_nextval acs_object_id_seq] } + if {[exists_and_not_null party_id]} { + set creation_user $party_id + } else { + set creation_user [ad_conn user_id] + } + # add in the new entry logger::entry::new -entry_id $entry_id \ -project_id $logger_project_id \ -variable_id $variable_id \ -value $value \ -time_stamp $timestamp_ansi \ - -description $description + -description $description \ + -party_id $creation_user # if we have a pm_task_id, then we need to note that this # entry is logged to a particular task. @@ -173,6 +187,7 @@ {-parent_id ""} {-goal ""} {-description ""} + {-mime_type "text/plain"} {-planned_start_date ""} {-planned_end_date ""} {-actual_start_date ""} @@ -206,7 +221,6 @@ # create a logger project set logger_project [logger::project::new \ -name $project_name \ - -description $description \ -project_lead $creation_user \ ] @@ -265,8 +279,19 @@ } { Stub for project edit - - + @author Jade Rubick (jader@bread.com) + @creation-date 2004-03-03 + + @param project_item_id + + @param project_name + + @return + + @error +} { + + set returnval [db_exec_plsql update_project " select pm_project__new_project_revision ( :project_item_id, :project_name, @@ -278,29 +303,18 @@ to_timestamp(:planned_end_date,'YYYY MM DD HH24 MI SS'), null, null, + :logger_project, :ongoing_p, :status_id, - :customer_id, + :organization_id, now(), - :user_id, - :peeraddr, + :creation_user, + :creation_ip, :package_id ); - - + "] - @author Jade Rubick (jader@bread.com) - @creation-date 2004-03-03 - - @param project_item_id - - @param project_name - - @return - - @error -} { - + return $returnval } @@ -552,7 +566,8 @@ latest_finish(i) = latest_start(i) + activity_time(i) - Tasks in ongoing projects are given null completion dates. + Tasks in ongoing projects are given null completion dates, + unless they already have deadlines.

@@ -575,6 +590,9 @@ For a project with subprojects, the statistics are based on the tasks of both of those projects. +

+ Tasks which are closed are not updated + @author Jade Rubick (jader@bread.com) @creation-date 2004-02-19 @@ -595,6 +613,11 @@ # to improve this in the future, be more intelligent about what is updated. # i.e., this procedure updates everything, which is necessary sometimes, # but not if you only edit one task. + # + # I added in an optimization to only save when something has + # changed -- JR + # I added in another optimization that only saves tasks that are + # open -- JR # ------------------------------------------------------------------------- # Add in resource limits. (it's not realistic that 300 tasks can be done in # one day) @@ -667,16 +690,34 @@ db_foreach tasks_query { } { + # We now save information about all the tasks, so that we can + # save on database hits later. Specifically, what we'll do is + # we won't need to save changes if the earliest_start, + # earliest finish, latest_start and latest_finish all haven't + # changed at all. We also save whether the task is open (o) or + # closed(c). + + set old_ES_j($my_iid) $old_earliest_start_j + set old_EF_j($my_iid) $old_earliest_finish_j + set old_LS_j($my_iid) $old_latest_start_j + set old_LF_j($my_iid) $old_latest_finish_j + set old_task_status($my_iid) $status_type + + # ns_log Notice "old_task_status: $my_iid $status_type" + set activity_time($my_iid) [expr $to_work - $worked] if {[exists_and_not_null task_deadline_j]} { - # ns_log notice "$my_iid has a deadline $task_jdeadline_j" + # ns_log notice "$my_iid has a deadline $task_deadline_j" set latest_finish($my_iid) $task_deadline_j - set latest_start($my_iid) [latest_start $task_deadline_j $activity_time($my_iid) $hours_day] - + set latest_start($my_iid) [pm::project::latest_start \ + -end_date_j $task_deadline_j \ + -hours_to_complete $activity_time($my_iid) \ + -hours_day $hours_day] + } } @@ -709,7 +750,7 @@ db_1row project_info { } if {[string equal $ongoing_p t] && ![empty_string_p $end_date_j]} { - ns_log Error "Project cannot be ongoing and have a non-null end-date" + ns_log Error "Project cannot be ongoing and have a non-null end-date. Setting end date to blank" set end_date_j "" } @@ -797,6 +838,11 @@ set max_earliest_start 0 + # testing if this fixes the bug + if {![exists_and_not_null depends($task_item)]} { + set depends($task_item) [list] + } + foreach dependent_item $depends($task_item) { set my_earliest_start [my_earliest_start $earliest_start($dependent_item) $activity_time($dependent_item) $hours_day] @@ -807,7 +853,7 @@ } set earliest_start($task_item) $max_earliest_start - # set earliest_finish($task_item) [expr $max_earliest_start + [expr $activity_time($task_item) / double($hours_day)]] + set earliest_finish($task_item) [earliest_finish $max_earliest_start $activity_time($task_item) $hours_day] # ns_log Notice \ @@ -851,7 +897,7 @@ # Note the latest_finish dates may be set to an arbitrary deadline. # Also note that it is possible for a project to be ongoing. # In that case, the latest_start and latest_finish dates should - # be set to null. + # be set to null, unless there is a hard deadline (end_date). # ----------------------------------------------------------------- # If these represent the dependency hierarchy: # 2155 @@ -1209,7 +1255,23 @@ set lf "" } - db_dml update_task { } + # Only update the task if something has actually + # changed. Hopefully this should help speed things up. + + if { \ + [string equal $es $old_ES_j($task_item)] && \ + [string equal $ef $old_EF_j($task_item)] && \ + [string equal $ls $old_LS_j($task_item)] && \ + [string equal $lf $old_LF_j($task_item)]} { + # do nothing + } else { + # if the task is open... + if {[string equal "o" $old_task_status($task_item)]} { + db_dml update_task { } + } + } + + } Index: openacs-4/contrib/packages/project-manager/tcl/role-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/role-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/tcl/role-procs.tcl 27 Apr 2004 00:49:28 -0000 1.1 @@ -0,0 +1,30 @@ +# + +ad_library { + + Procs for roles + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-04-05 + @arch-tag: 226cb104-9e32-4de3-9f93-ab96e239ca93 + @cvs-id $Id: role-procs.tcl,v 1.1 2004/04/27 00:49:28 jader Exp $ +} + + +namespace eval pm::role {} + +ad_proc -public pm::role::default { +} { + Gets the default role. This is pretty much random, but the first + role selected + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-04-05 + + @return role_id + + @error -1 if there is an error. +} { + set returnval [db_string get_default "select role_id from pm_roles limit 1" -default "-1"] + return $returnval +} Index: openacs-4/contrib/packages/project-manager/tcl/task-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/task-procs-postgresql.xql,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/project-manager/tcl/task-procs-postgresql.xql 12 Mar 2004 13:44:43 -0000 1.4 +++ openacs-4/contrib/packages/project-manager/tcl/task-procs-postgresql.xql 27 Apr 2004 00:49:28 -0000 1.5 @@ -27,6 +27,27 @@ + + + select status + from pm_tasks + where task_id = :task_item_id + + + + + + SELECT + case when status_type = 'c' then 0 else 1 end as open_p + FROM + pm_tasks t, + pm_task_status s + WHERE + task_id = :task_item_id and + t.status = s.status_id + + + select status_id @@ -60,6 +81,7 @@ :project_item_id, :title, :description, + :mime_type, [pm::util::datenvl -value $end_date -value_if_null "null" -value_if_not_null "to_timestamp('$end_date','YYYY MM DD HH24 MI SS')"], :percent_complete, :estimated_hours_work, @@ -76,20 +98,21 @@ - select pm_task__new_task_item ( - :project_id, - :title, - :description, - :end_date, - :percent_complete, - :estimated_hours_work, - :estimated_hours_work_min, - :estimated_hours_work_max, - :status_id, - coalesce (:creation_date,current_timestamp), - :creation_user, - :creation_ip, - :package_id) + select pm_task__new_task_item ( + :project_id, + :title, + :description, + :mime_type, + [pm::util::datenvl -value $end_date -value_if_null "null" -value_if_not_null "to_timestamp('$end_date','YYYY MM DD HH24 MI SS')"], + :percent_complete, + :estimated_hours_work, + :estimated_hours_work_min, + :estimated_hours_work_max, + :status_id, + coalesce (:creation_date,current_timestamp), + :creation_user, + :creation_ip, + :package_id) 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 -r1.5 --- openacs-4/contrib/packages/project-manager/tcl/task-procs.tcl 12 Mar 2004 13:44:43 -0000 1.4 +++ openacs-4/contrib/packages/project-manager/tcl/task-procs.tcl 27 Apr 2004 00:49:28 -0000 1.5 @@ -225,9 +225,9 @@ @return task_item_id - @error + @error Returns -1 if there is no such task } { - set return_val [db_string get_item_id { }] + set return_val [db_string get_item_id { } -default "-1"] return $return_val } @@ -246,15 +246,37 @@ @return task_item_id - @error + @error If there is no such task item, then returns -1 } { - set return_val [db_string get_revision_id { }] + set return_val [db_string get_revision_id { } -default "-1"] return $return_val } +ad_proc -public pm::task::current_status { + -task_item_id:required +} { + Returns the current status value for open tasks +} { + set return_val [db_string get_current_status { }] + + return $return_val +} + + +ad_proc -public pm::task::open_p { + -task_item_id:required +} { + Returns 1 if the task is open, 0 otherwise +} { + set return_val [db_string open_p { }] + + return $return_val +} + + ad_proc -public pm::task::default_status_open {} { Returns the default status value for open tasks } { @@ -279,6 +301,7 @@ -project_item_id:required -title:required -description:required + {-mime_type "text/plain"} -end_date:required -percent_complete:required -estimated_hours_work:required @@ -303,6 +326,8 @@ @param description + @param mime_type + @param end_date @param percent_complete @@ -327,16 +352,26 @@ @error } { - if {$percent_complete >= 100} { - set status_id [pm::task::default_status_closed] + if {![exists_and_not_null status_id]} { + set status_id [pm::task::current_status \ + -task_item_id $task_item_id] } - if {![exists_and_not_null status_id]} { - set status_id [pm::task::default_status_open] + if {$estimated_hours_work_min > $estimated_hours_work_max} { + set temp $estimated_hours_work_max + set estimated_hours_work_max $estimated_hours_work_min + set estimated_hours_work_min $temp } set return_val [db_exec_plsql new_task_revision { *SQL }] + # if the we've done 100% of the work, then we close the task + if {$percent_complete >= 100} { + pm::task::close -task_item_id $task_item_id + } else { + pm::task::open -task_item_id $task_item_id + } + return $return_val } @@ -346,6 +381,7 @@ -project_id:required -title:required {-description ""} + {-mime_type "text/plain"} {-end_date ""} {-percent_complete "0"} {-estimated_hours_work "0"} @@ -361,13 +397,39 @@ set status_id [pm::task::default_status_open] } + if {$estimated_hours_work_min > $estimated_hours_work_max} { + set temp $estimated_hours_work_max + set estimated_hours_work_max $estimated_hours_work_min + set estimated_hours_work_min $temp + } + set return_val [db_exec_plsql new_task_item { *SQL }] return $return_val } +ad_proc -public pm::task::delete { + -task_item_id:required +} { + Deletes a given task + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-03-10 + + @param task_item_id + + @return 1, no matter once + + @error No error thrown if there is no such task. +} { + db_exec_plsql delete_task "select pm_task__delete_task_item(:task_item_id)" + + return 1 +} + + ad_proc -public pm::task::get_url { object_id } { @@ -496,3 +558,655 @@ return $total_logged_hours } + + +ad_proc -public pm::task::link { + -task_item_id_1:required + -task_item_id_2:required +} { + Links two tasks together + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-03-10 + + @param task_item_id_1 + + @param task_item_id_2 + + @return + + @error +} { + + if {[string equal $task_item_id_1 $task_item_id_2]} { + # do nothing + ns_log Notice "Project-manager: Cannot link a task to itself!" + } elseif {$task_item_id_1 < $task_item_id_2} { + db_dml link_tasks " + INSERT INTO + pm_task_xref + (task_id_1, task_id_2) + VALUES + (:task_item_id_1, :task_item_id_2)" + } else { + db_dml link_tasks " + INSERT INTO + pm_task_xref + (task_id_1, task_id_2) + VALUES + (:task_item_id_2, :task_item_id_1)" + } + +} + + +ad_proc -public pm::task::assign_remove_everyone { + -task_item_id:required +} { + Removes all assignments for a task + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-04-09 + + @param task_item_id + + @return + + @error +} { + db_dml remove_assignment " + delete from pm_task_assignment where task_id = :task_item_id" +} + + +ad_proc -public pm::task::assign { + -task_item_id:required + -party_id:required + {-role_id ""} +} { + Assigns party_id to task_item_id + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-04-05 + + @param task_item_id + + @param party_id + + @param role_id the role under which the person is assigned + + @return + + @error +} { + if {![exists_and_not_null role_id]} { + set role_id [pm::role::default] + } + + db_dml add_assignment " + insert into pm_task_assignment + (task_id, + role_id, + party_id) + values + (:task_item_id, + :role_id, + :party_id) + " +} + + +ad_proc -public pm::task::open { + -task_item_id:required +} { + Opens a task, and sends notifications, unless it was already + open. If it was already open, does nothing. + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-04-22 + + @param task_item_id + + @return + + @error +} { + # find out what the status of the task was, and while we're at it, + # get other interesting information about the task, in case we + # want to close it. Then we can put this info in the email. + + db_1row get_status " + SELECT + t.status, + s.status_type, + s.description as status_description, + r.title as task_title, + r.estimated_hours_work, + r.estimated_hours_work_min, + r.estimated_hours_work_max, + to_char(r.earliest_start, 'YYYY-MM-DD HH24:MI:SS') as earliest_start_ansi, + to_char(r.earliest_finish, 'YYYY-MM-DD HH24:MI:SS') as earliest_finish_ansi, + to_char(r.latest_start, 'YYYY-MM-DD HH24:MI:SS') as latest_start_ansi, + to_char(r.latest_finish, 'YYYY-MM-DD HH24:MI:SS') as latest_finish_ansi, + r.description as task_description, + project_revision.title as project_name + FROM + pm_tasks t, + cr_items task_item, + pm_task_status s, + pm_tasks_revisionsx r, + cr_items project_item, + cr_revisions project_revision + WHERE + r.parent_id = project_item.item_id and + t.task_id = task_item.item_id and + task_item.live_revision = r.revision_id and + project_item.live_revision = project_revision.revision_id and + r.item_id = t.task_id and + t.status = s.status_id and + t.task_id = :task_item_id" + + if {[string equal $status_type "o"]} { + + # this is already open + return + + } + + # set the new status + + set status_code [pm::task::default_status_open] + + db_dml update_status " + UPDATE + pm_tasks + SET + status = :status_code + WHERE + task_id = :task_item_id" + + # send out an email notification + + set earliest_start [lc_time_fmt $earliest_start_ansi "%x"] + set earliest_finish [lc_time_fmt $earliest_finish_ansi "%x"] + set latest_start [lc_time_fmt $latest_start_ansi "%x"] + set latest_finish [lc_time_fmt $latest_finish_ansi "%x"] + + set assignees [db_list get_assignees " + select + email + FROM + pm_task_assignment a, + parties p + WHERE + task_id = :task_item_id and + a.party_id = p.party_id + "] + + if {[llength $assignees] > 0} { + + set to_address [join $assignees ", "] + + set user_id [ad_conn user_id] + + set from_address [db_string get_from_email "select email from parties where party_id = :user_id" -default "nobody@nowhere.com"] + + set task_url "[parameter::get_from_package_key -package_key acs-kernel -parameter SystemURL][ad_conn package_url]task-one?task_id=$task_item_id" + + set subject "Task reopened (was $status_description): $task_title" + + if {[parameter::get_from_package_key -package_key project-manager -parameter UseUncertainCompletionTimesP]} { + set estimated_work "\nHrs work (min): $estimated_hours_work_min\nHrs work (max): $estimated_hours_work_max" + } else { + set estimated_work "\nHrs work: $estimated_hours_work" + + } + + set notification_text "Task reopened, was $status_description\n\n" + + append notification_text " +------------- +Task ID: \#$task_item_id +Description: $task_title +Project: $project_name + +Link: $task_url + +--------------- +Estimated work: +---------------$estimated_work + +------ +Dates: +------ +Earliest start: $earliest_start +Earliest finish: $earliest_finish +Latest start: $latest_start +Latest finish $latest_finish + +----------- +Description +----------- +$task_description" + + + append notification_text "\n" + + acs_mail_lite::send \ + -to_addr $to_address \ + -from_addr $from_address \ + -subject $subject \ + -body $notification_text + } + + return +} + +ad_proc -public pm::task::close { + -task_item_id:required +} { + Closes a task, and sends notifications, unless it was already + closed. If it was already closed, does nothing. + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-04-22 + + @param task_item_id + + @return + + @error +} { + # find out what the status of the task was + + db_1row get_status " + SELECT + t.status, + s.status_type, + s.description as status_description, + r.title as task_title, + r.estimated_hours_work, + r.estimated_hours_work_min, + r.estimated_hours_work_max, + to_char(r.earliest_start, 'YYYY-MM-DD HH24:MI:SS') as earliest_start_ansi, + to_char(r.earliest_finish, 'YYYY-MM-DD HH24:MI:SS') as earliest_finish_ansi, + to_char(r.latest_start, 'YYYY-MM-DD HH24:MI:SS') as latest_start_ansi, + to_char(r.latest_finish, 'YYYY-MM-DD HH24:MI:SS') as latest_finish_ansi, + r.description as task_description, + project_revision.title as project_name + FROM + pm_tasks t, + cr_items task_item, + pm_task_status s, + pm_tasks_revisionsx r, + cr_items project_item, + cr_revisions project_revision + WHERE + r.parent_id = project_item.item_id and + t.task_id = task_item.item_id and + task_item.live_revision = r.revision_id and + project_item.live_revision = project_revision.revision_id and + r.item_id = t.task_id and + t.status = s.status_id and + t.task_id = :task_item_id" + + if {[string equal $status_type "c"]} { + + # this is already closed + return + + } + + # set the new status + + set status_code [pm::task::default_status_closed] + + db_dml update_status " + UPDATE + pm_tasks + SET + status = :status_code + WHERE + task_id = :task_item_id" + + # send out an email notification + + set earliest_start [lc_time_fmt $earliest_start_ansi "%x"] + set earliest_finish [lc_time_fmt $earliest_finish_ansi "%x"] + set latest_start [lc_time_fmt $latest_start_ansi "%x"] + set latest_finish [lc_time_fmt $latest_finish_ansi "%x"] + + + set assignees [db_list get_assignees " + select + email + FROM + pm_task_assignment a, + parties p + WHERE + task_id = :task_item_id and + a.party_id = p.party_id + "] + + if {[llength $assignees] > 0} { + + set to_address [join $assignees ", "] + + set user_id [ad_conn user_id] + + set from_address [db_string get_from_email "select email from parties where party_id = :user_id" -default "nobody@nowhere.com"] + + set last_time_stamp "" + set work_log "----------------------\nWork done on this task\n----------------------\n\n" + + db_foreach get_logged_time " + SELECT + to_char(le.time_stamp, 'fmDyfm fmMMfm-fmDDfm-YYYY') as time_stamp_pretty, + le.value, + le.description, + r.title as task_name, + submitter.first_names || ' ' || submitter.last_name as user_name + FROM + logger_entries le, + cr_items i, + cr_revisions r, + pm_task_logger_proj_map m, + logger_projects lp, + acs_objects ao, + acs_users_all submitter + WHERE + r.item_id = m.task_item_id and + i.live_revision = r.revision_id and + r.item_id = :task_item_id and + le.project_id = lp.project_id and + ao.object_id = le.entry_id and + le.entry_id = m.logger_entry and + ao.creation_user = submitter.user_id + ORDER BY + le.time_stamp desc" { + if {![string equal $time_stamp_pretty $last_time_stamp]} { + append work_log "* $time_stamp_pretty\n\n" + } + append work_log "[pm::util::string_truncate_and_pad -length 25 -string "$user_name:"] $description ($value hrs)\n" + + set last_time_stamp $time_stamp_pretty + } + + set task_url "[parameter::get_from_package_key -package_key acs-kernel -parameter SystemURL][ad_conn package_url]task-one?task_id=$task_item_id" + + set subject "Task closed (was $status_description) $task_title" + + if {[parameter::get_from_package_key -package_key project-manager -parameter UseUncertainCompletionTimesP]} { + set estimated_work "\nHrs work (min): $estimated_hours_work_min\nHrs work (max): $estimated_hours_work_max" + } else { + set estimated_work "\nHrs work: $estimated_hours_work" + + } + + set notification_text "Task closed, was $status_description\n\n" + + append notification_text " +------------- +Task ID: \#$task_item_id +Description: $task_title +Project: $project_name + +Link: $task_url +" + append notification_text "\n\n$work_log" + + append notification_text " +--------------- +Estimated work: +---------------$estimated_work + +------ +Dates: +------ +Earliest start: $earliest_start +Earliest finish: $earliest_finish +Latest start: $latest_start +Latest finish $latest_finish + +----------- +Description +----------- +$task_description" + + + acs_mail_lite::send \ + -to_addr $to_address \ + -from_addr $from_address \ + -subject $subject \ + -body $notification_text + } + + return +} + + + +ad_proc -public pm::task::email_status {} { + + set send_email_p [parameter::get_from_package_key -package_key "project-manager" -parameter SendDailyEmail -default "0"] + + if {[string equal $send_email_p "0"]} { + ns_log Notice "Parameter SendDailyEmail for project manager says skip email today" + return + } + + acs_mail_lite::send \ + -to_addr jader@bread.com \ + -from_addr jader@bread.com \ + -subject "Reminder: pm::task::email_status is starting..." \ + -body "It is starting" + + set parties [list] + + # 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 " + SELECT + ts.task_id, + ts.task_id as item_id, + ts.task_number, + t.task_revision_id, + t.title, + to_char(t.earliest_start,'J') as earliest_start_j, + to_char(current_timestamp,'J') as today_j, + to_char(t.latest_start,'J') as latest_start_j, + to_char(t.latest_start,'YYYY-MM-DD HH24:MI') as latest_start, + to_char(t.latest_finish,'YYYY-MM-DD HH24:MI') as latest_finish, + t.percent_complete, + t.estimated_hours_work, + t.estimated_hours_work_min, + t.estimated_hours_work_max, + case when t.actual_hours_worked is null then 0 + else t.actual_hours_worked end as actual_hours_worked, + to_char(t.earliest_start,'YYYY-MM-DD HH24:MI') as earliest_start, + to_char(t.earliest_finish,'YYYY-MM-DD HH24:MI') as earliest_finish, + to_char(t.latest_start,'YYYY-MM-DD HH24:MI') as latest_start, + to_char(t.latest_finish,'YYYY-MM-DD HH24:MI') as latest_finish, + p.first_names || ' ' || p.last_name as full_name, + p.party_id, + (select one_line from pm_roles r where ta.role_id = r.role_id) as role + FROM + pm_tasks ts, + pm_tasks_revisionsx t, + pm_task_assignment ta, + acs_users_all p, + cr_items i, + pm_task_status s + WHERE + ts.task_id = t.item_id and + i.item_id = t.item_id and + t.task_revision_id = i.live_revision and + ts.status = s.status_id and + s.status_type = 'o' and + 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"] + + 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 + } + } + + # 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" + set address [db_string get_email "select email from parties where party_id = :party" -default "jade-errors@bread.com"] + + set overdue [list] + set pressing [list] + set longterm [list] + + foreach task $task_list($party) { + + if {$slack_arr($task) < $OVERDUE_THRESHOLD} { + set which_pile overdue + } elseif {$slack_arr($task) < $PRESSING_THRESHOLD} { + set which_pile pressing + } elseif {$slack_arr($task) < $PRESSING_THRESHOLD} { + set which_pile longterm + } else { + set which_pile "" + } + + 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 "$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 [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_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_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" + + lappend description "" + lappend description "\# $overdue_title" + + set length [string length $overdue_description] + lappend description [string repeat "_" $length] + + lappend description $overdue_description + + lappend description "" + foreach overdue_item $overdue { + lappend description $overdue_item + } + + lappend description "" + lappend description "\# $pressing_title" + + set length [string length $pressing_description] + lappend description [string repeat "_" $length] + + lappend description $pressing_description + + + lappend description "" + foreach pressing_item $pressing { + lappend description $pressing_item + } + + lappend description "" + lappend description "\# $longterm_title" + + set length [string length $longterm_description] + lappend description [string repeat "_" $length] + + lappend description $longterm_description + + lappend description "" + foreach longterm_item $longterm { + lappend description $longterm_item + } + + acs_mail_lite::send \ + -to_addr $address \ + -from_addr $address \ + -subject $subject \ + -body [join $description "\n"] + + } + + # consider also sending out emails to people who have assigned + # tickets to nobody + +} + + + +ad_proc -private pm::task::email_status_init { +} { + Schedules the daily emailings + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-04-14 + + @return + + @error +} { + ns_log Notice "Scheduling daily email notifications for project manager to 5:00 am" + ad_schedule_proc -thread t -debug t -schedule_proc ns_schedule_daily "5 0" pm::task::email_status +} Index: openacs-4/contrib/packages/project-manager/www/add-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/add-edit-2.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/project-manager/www/add-edit-2.tcl 12 Mar 2004 13:44:44 -0000 1.4 +++ openacs-4/contrib/packages/project-manager/www/add-edit-2.tcl 27 Apr 2004 00:49:29 -0000 1.5 @@ -38,8 +38,12 @@ # --------------------------------------------------------------- # # the unique identifier for this package set package_id [ad_conn package_id] +set subsite_id [ad_conn subsite_id] set user_id [ad_maybe_redirect_for_registration] +set user_group_id [application_group::group_id_from_package_id \ + -package_id $subsite_id] + # terminology set project_term [parameter::get -parameter "ProjectName" -default "Project"] set project_term_lower [parameter::get -parameter "projectname" -default "project"] Index: openacs-4/contrib/packages/project-manager/www/add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/add-edit.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/contrib/packages/project-manager/www/add-edit.tcl 12 Mar 2004 13:44:44 -0000 1.16 +++ openacs-4/contrib/packages/project-manager/www/add-edit.tcl 27 Apr 2004 00:49:29 -0000 1.17 @@ -134,15 +134,15 @@ if {[exists_and_not_null project_id]} { if {![empty_string_p [category_tree::get_mapped_trees $package_id]]} { ad_form -extend -name add_edit -form { - {category_ids:integer(category),multiple,optional {label "Categories"} + {category_ids:integer(category),multiple {label "Categories"} {html {size 4}} {value {$project_item_id $package_id}} } } } } else { if {![empty_string_p [category_tree::get_mapped_trees $package_id]]} { ad_form -extend -name add_edit -form { - {category_ids:integer(category),multiple,optional {label "Categories"} + {category_ids:integer(category),multiple {label "Categories"} {html {size 4}} {value {}} } } @@ -256,7 +256,6 @@ set project_item_id [pm::project::get_project_item_id \ -project_id $project_id] - pm::project::compute_parent_status $project_item_id if {[exists_and_not_null category_ids]} { @@ -266,9 +265,11 @@ if {$use_project_customizations_p} { ad_returnredirect "add-edit-2?[export_url_vars project_id old_project_id]" + pm::project::compute_parent_status $project_item_id ad_script_abort } else { ad_returnredirect "one?[export_url_vars project_id]" + pm::project::compute_parent_status $project_item_id ad_script_abort } } Index: openacs-4/contrib/packages/project-manager/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/index.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/contrib/packages/project-manager/www/index.tcl 12 Mar 2004 13:44:44 -0000 1.13 +++ openacs-4/contrib/packages/project-manager/www/index.tcl 27 Apr 2004 00:49:29 -0000 1.14 @@ -142,7 +142,7 @@ customer_name { label "Customer" display_template " -@projects.customer_name@@projects.customer_name@ +@projects.customer_name@@projects.customer_name@ " } project_name { @@ -183,7 +183,7 @@ } } \ -orderby { - default_value project_name,asc + default_value latest_finish_date,asc project_name { label "Project name" orderby_desc "upper(p.title) desc" Index: openacs-4/contrib/packages/project-manager/www/log-bulk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/log-bulk.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/log-bulk.adp 27 Apr 2004 00:49:29 -0000 1.1 @@ -0,0 +1,6 @@ + + @title@ + @context@ + +This page will eventually allow you to log hours against multiple +tasks at once. Index: openacs-4/contrib/packages/project-manager/www/log-bulk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/log-bulk.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/log-bulk.tcl 27 Apr 2004 00:49:29 -0000 1.1 @@ -0,0 +1,27 @@ +# + +ad_page_contract { + + Logs hours against multiple tasks at once. + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-04-13 + @arch-tag: 4d3fcd3a-71d0-4ca5-9213-51e4c4ec4620 + @cvs-id $Id: log-bulk.tcl,v 1.1 2004/04/27 00:49:29 jader Exp $ + + @param item_id A multiple containing the task item_ids +} { + item_id:multiple + {return_url ""} +} -properties { +} -validate { +} -errors { +} + +set title "Log time for multiple tasks" + +if {[exists_and_not_null return_url]} { + set context [list [list $return_url Tasks] "Log time"] +} else { + set context [list "Log time"] +} Index: openacs-4/contrib/packages/project-manager/www/log.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/log.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/project-manager/www/log.tcl 12 Mar 2004 13:44:44 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/log.tcl 27 Apr 2004 00:49:29 -0000 1.3 @@ -14,13 +14,25 @@ {edit:boolean "f"} {return_url "."} } -validate { - project_id_required_in_add_mode { + #project_id_required_in_add_mode { # For the sake of simplicity of the form # we are requiring a project_id to be provided in add mode - if { ![exists_and_not_null entry_id] && ![exists_and_not_null project_id] } { - ad_complain "When adding a log entry a project_id must be provided (either entry_id or project_id must be present)." - } + #if { ![exists_and_not_null entry_id] && ![exists_and_not_null project_id] } { + # ad_complain "When adding a log entry a project_id must be provided (either entry_id or project_id must be present)." + #} + #} +} + +if { ![exists_and_not_null project_id] } { + + if {[exists_and_not_null entry_id]} { + # do nothing + } else { + set project_id [pm::project::get_logger_project \ + -project_item_id $pm_project_id] + } + } set package_id [ad_conn package_id] @@ -189,12 +201,17 @@ else percent_complete end as percent_complete, estimated_hours_work, estimated_hours_work_min, - estimated_hours_work_max + estimated_hours_work_max, + s.description as status_description FROM pm_tasks_revisionsx p, - cr_items i + cr_items i, + pm_task_status s, + pm_tasks t WHERE i.item_id = p.item_id and p.item_id = :pm_task_id and + i.item_id = t.task_id and + t.status = s.status_id and p.revision_id = i.live_revision" ad_form -extend -name log_entry_form -form { @@ -205,6 +222,11 @@ {value $task_title} } + {status_description:text(inform) + {label "Status"} + {value $status_description} + } + } if {[string equal $use_uncertain_completion_times_p 1]} { @@ -297,6 +319,17 @@ cr_items where item_id = :pm_task_id)" + + if {$percent_complete >= 100} { + + pm::task::close -task_item_id $pm_task_id + + } else { + + pm::task::open -task_item_id $pm_task_id + + } + } } else { @@ -308,7 +341,7 @@


-You have already added this entry once. If you want to edit this entry, click here. +You have already added this entry once. If you want to edit this entry, click here. [ad_footer] " @@ -346,13 +379,34 @@ pm::task::update_hours \ -task_item_id $pm_task_id - pm::project::compute_status $pm_project_id + + if {$percent_complete >= 100} { + set status_code [pm::task::default_status_closed] + } else { + set status_code [pm::task::default_status_open] + } + + db_dml update_percent " + UPDATE + pm_tasks + SET + status = :status_code + WHERE + task_id = :pm_task_id" + + } set pm_task_id $old_pm_task_id } -after_submit { ad_returnredirect "[ad_conn url]?[export_vars { project_id variable_id return_url pm_project_id pm_task_id}]" + # ad_returnredirect $return_url + + if {![string equal $pm_task_id -1]} { + pm::project::compute_status $pm_project_id + } + ad_script_abort } Index: openacs-4/contrib/packages/project-manager/www/one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/one-postgresql.xql,v diff -u -r1.23 -r1.24 --- openacs-4/contrib/packages/project-manager/www/one-postgresql.xql 12 Mar 2004 13:44:45 -0000 1.23 +++ openacs-4/contrib/packages/project-manager/www/one-postgresql.xql 27 Apr 2004 00:49:29 -0000 1.24 @@ -10,6 +10,7 @@ p.project_code, p.goal, p.description, + p.mime_type, to_char(p.planned_start_date,'YYYY-MM-DD HH24:MI') as planned_start_date, to_char(p.planned_end_date,'YYYY-MM-DD HH24:MI') as planned_end_date, p.logger_project, @@ -84,10 +85,26 @@ t.estimated_hours_work_max, t.actual_hours_worked FROM - (select * from pm_tasks_revisionsx LEFT JOIN pm_task_assignment ON item_id = task_id) t LEFT JOIN persons u ON t.party_id = u.person_id, cr_items i LEFT JOIN pm_task_dependency d ON i.item_id = d.task_id + (select * from pm_tasks_revisionsx + LEFT JOIN + pm_task_assignment ON item_id = task_id) t + LEFT JOIN + persons u + ON + t.party_id = u.person_id, + cr_items i + LEFT JOIN + pm_task_dependency d + ON + i.item_id = d.task_id, + pm_tasks ti, + pm_task_status s WHERE t.parent_id = :project_item_id and - t.revision_id = i.live_revision + t.revision_id = i.live_revision and + t.item_id = ti.task_id and + ti.status = s.status_id and + s.status_type = :status_type [template::list::orderby_clause -name tasks -orderby] Index: openacs-4/contrib/packages/project-manager/www/one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/one.adp,v diff -u -r1.31 -r1.32 --- openacs-4/contrib/packages/project-manager/www/one.adp 12 Mar 2004 13:44:45 -0000 1.31 +++ openacs-4/contrib/packages/project-manager/www/one.adp 27 Apr 2004 00:49:29 -0000 1.32 @@ -1,257 +1,268 @@ - - - @project_term@ #@project_item_id@: @project.project_name;noquote@ + @my_title@ @context@

(not current, select live version below)

-
- -
- - - - - - +
- - Edit - - -   @project_term@ - -
+ + - + + + + +
-
- - +
+ + - - - +   @project_term@ - - - - - - + + + + + + - -
+ + Edit + -
Name@project.project_name@
Code@project.project_code@
- + + - - - - - - - - - - -
Goal@project.goal@
Description@project.description@
-
- -

- - - - - - - - - -
Dates
- - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - -
Start@project.planned_start_date@
Earliest finish@project.earliest_finish_date@Name@project.project_name@
Code@project.project_code@
Ongoing
Deadline@project.planned_end_date@
Goal@project.goal@
Ongoing
Latest finish@project.latest_finish_date@Ongoing
Task hours completed@project.actual_hours_completed@ of @project.estimated_hours_total@
-
- -

- - + +

Description@project.description;noquote@
+ + + +

+ - + - +
Project informationDates
- - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Customer@custom.customer_name@Start@project.planned_start_date@
Earliest finish@project.earliest_finish_date@Ongoing
Deadline@project.planned_end_date@Ongoing
Latest finish@project.latest_finish_date@Ongoing
Task hours completed@project.actual_hours_completed@ of @project.estimated_hours_total@
- - -

- - - - - - - - -
Categories
- - - - -
- -
    - - -
  • @categories:item@ - - -
- -
-
- -

- - - - - +

-

- - - - - +
Subprojects
Add subproject + +

+ + + + - - - - -
Project information
- - - - - - - - - - - + + + +
@task_term@
+ + + + + +
Customer@custom.customer_name@
+
+ + +

+ + + + + + + + + +
Categories
+ + + + +
+ +
    + + +
  • @categories:item@ + + +
+ +
+
+ +

+ + + + + + + + + +
Subprojects
Add subproject + + + +
+ +

- +  
-
    -
  • -
    - Add - - - - Tasks - -
    -
  • -
-
+ + + TASKS + -
+ + + + + + + + + + + + +
@task_term@
+ +
+
    +
  • +
    + Add + + + + + Tasks + +
    +
  • +
+ + + + +
+ +

+ + + + + + + + + + + + + + +
Logged hours
+ + Log hours + + + @log_note@ +
+ +
+ + + -

- - - - - - - - - - - - - - -
Logged hours
- - Log hours - - - @log_note@ -
- -
-

-
- +

REVISIONS

Index: openacs-4/contrib/packages/project-manager/www/one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/one.tcl,v diff -u -r1.30 -r1.31 --- openacs-4/contrib/packages/project-manager/www/one.tcl 12 Mar 2004 13:44:45 -0000 1.30 +++ openacs-4/contrib/packages/project-manager/www/one.tcl 27 Apr 2004 00:49:29 -0000 1.31 @@ -28,9 +28,11 @@ {orderby_subproject ""} {orderby_tasks ""} {orderby_versions ""} + {status_type "o"} } -properties { categories:onelist + my_title:onevalue context:onevalue project:multirow tasks:multirow @@ -64,10 +66,18 @@ -project_item_id $project_item_id] } } + status_type_exists { + if {![string equal $status_type "o"] && ![string equal $status_type "c"]} { + set status_type "o" + } + } } set original_project_id $project_id +# for edits of tasks. We want to come back to here. +set return_url "[ad_conn url]?[ad_conn query]" + # --------------------------------------------------------------- # # the unique identifier for this package @@ -107,6 +117,11 @@ } db_1row project_query { } -column_array project + +set richtext_list [list $project(description) $project(mime_type)] + +set project(description) [template::util::richtext::get_property html_value $richtext_list] + set project_root [db_exec_plsql get_root_folder { }] set project(planned_start_date) [lc_time_fmt $project(planned_start_date) "%x"] @@ -124,11 +139,12 @@ set log_note "Last 30 days" +set my_title "$project_term \#$project_item_id: $project(project_name)" + set edit_url "[ad_conn package_url]add-edit?[export_url_vars project_item_id]" # set up context bar, needs parent_id - if {[string equal $project(parent_id) $project_root]} { set context [list "View"] } else { @@ -168,15 +184,15 @@ } slack_time { label "Slack" - display_template "@tasks.slack_time@" + display_template "@tasks.slack_time@" } earliest_start { label "Earliest Start" - display_template "@tasks.earliest_start_pretty@@tasks.earliest_start_pretty@" + display_template "@tasks.earliest_start_pretty@@tasks.earliest_start_pretty@" } earliest_finish { label "Earliest Finish" - display_template "@tasks.earliest_finish_pretty@@tasks.earliest_finish_pretty@" + display_template "@tasks.earliest_finish_pretty@@tasks.earliest_finish_pretty@" } latest_start { label "Latest Start" @@ -202,23 +218,42 @@ project_item_id project_id {my_key 1} + {return_url} } \ -sub_class { narrow } \ -filters { - project_item_id {} - orderby_subproject {} - orderby_versions {} - orderby_people {} + status_type { + label "Status" + values {{"Open" "o"} {"Closed" "c"}} + where_clause {s.status_type = :status_type} + } + project_item_id { + hide_p 1 + } + orderby_subproject { + hide_p 1 + } + orderby_versions { + hide_p 1 + } + orderby_people { + hide_p 1 + } } \ -orderby { - title {orderby title} + default_value latest_start,asc + title { + label "Subject" + orderby_asc "title asc" + orderby_desc "title desc" + default_direction asc + } earliest_start {orderby earliest_start} earliest_finish {orderby earliest_finish} latest_start {orderby latest_start} latest_finish {orderby latest_finish} - default_value latest_start,asc } \ -orderby_name orderby_tasks \ -html { @@ -385,10 +420,10 @@ db_1row custom_query { } -column_array custom +set customer_link "[site_node::get_package_url -package_key organizations]one?organization_id=$custom(customer_id)" # end of customizations - # ----------------------------------------------------------------- # Logger forms and so on - shows time logged, and allows you to log # other time Index: openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-add-edit-2.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl 12 Mar 2004 13:44:45 -0000 1.6 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl 27 Apr 2004 00:49:29 -0000 1.7 @@ -26,6 +26,11 @@ {use_dependency:integer,multiple ""} } -validate { + no_estimated_hours { + if {![exists_and_not_null estimated_hours_work] && ![exists_and_not_null estimated_hours_work_min] && ![exists_and_not_null estimated_hours_work_max]} { + ad_complain + } + } process_id_missing { if {![exists_and_not_null process_id]} { ad_complain @@ -60,6 +65,8 @@ } } } -errors { + no_estimated_hours {You must enter estimated hours. If nothing + else, enter 0 for the estimated hours} process_id_missing {I don't know which process these tasks are for!} task_title_too_long {A task subject is too long. It must be 198 characters or less} description_too_long {A description subject is too long. It must be 3998 characters or less} Index: openacs-4/contrib/packages/project-manager/www/process-task-assign-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-assign-add-edit.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/contrib/packages/project-manager/www/process-task-assign-add-edit.tcl 12 Mar 2004 13:44:45 -0000 1.8 +++ openacs-4/contrib/packages/project-manager/www/process-task-assign-add-edit.tcl 27 Apr 2004 00:49:29 -0000 1.9 @@ -58,9 +58,13 @@ # the unique identifier for this package set package_id [ad_conn package_id] +set subsite_id [ad_conn subsite_id] set user_id [ad_maybe_redirect_for_registration] +set user_group_id [application_group::group_id_from_package_id \ + -package_id $subsite_id] + # permissions and more set title "Add a process $task_term_lower (assignment)" Index: openacs-4/contrib/packages/project-manager/www/task-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-add-edit-postgresql.xql,v diff -u -r1.15 -r1.16 --- openacs-4/contrib/packages/project-manager/www/task-add-edit-postgresql.xql 12 Mar 2004 13:44:45 -0000 1.15 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit-postgresql.xql 27 Apr 2004 00:49:29 -0000 1.16 @@ -20,27 +20,6 @@ - - - select pm_task__new_task_revision ( - :p_task_item_id, - :project_item_id, - :p_task_title, - :p_description, - [pm::util::datenvl -value [set end_date_$i] -value_if_null "null," -value_if_not_null "to_timestamp('[set end_date_$i]','YYYY MM DD HH24 MI SS'),"] - :p_percent, - :p_work, - :p_work_min, - :p_work_max, - :p_hours, - current_timestamp, - :user_id, - :peeraddr, - :package_id - ); - - - select @@ -54,6 +33,7 @@ t.task_revision_id, t.title as my_task_title, t.description as my_description, + t.mime_type as my_mime_type, to_char(t.end_date,'YYYY MM DD') as my_end_date, t.percent_complete as my_percent_complete, t.estimated_hours_work as my_estimated_work, @@ -96,17 +76,35 @@ - select + SELECT r.item_id, r.title as task_title FROM pm_tasks_revisionsx r, - cr_items i + cr_items i, + pm_tasks t, + pm_task_status s WHERE r.parent_id = :project_item_id and - r.revision_id = i.live_revision - ORDER BY - upper(r.title) + r.revision_id = i.live_revision and + i.item_id = t.task_id and + t.status = s.status_id and + s.status_type = 'o' + UNION + SELECT + r.item_id, + r.title as task_title + FROM + pm_tasks_revisionsx r, + cr_items i, + pm_tasks t + WHERE + r.parent_id = :project_item_id and + r.revision_id = i.live_revision and + i.item_id = t.task_id and + t.task_id in ([join $my_dependencies ","]) + ORDER BY + task_title Index: openacs-4/contrib/packages/project-manager/www/task-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-add-edit.adp,v diff -u -r1.13 -r1.14 --- openacs-4/contrib/packages/project-manager/www/task-add-edit.adp 20 Apr 2004 21:12:20 -0000 1.13 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit.adp 27 Apr 2004 00:49:29 -0000 1.14 @@ -1,16 +1,16 @@ @title;noquote@ @context@ - - + +

- + - + - + - + @@ -149,15 +149,15 @@ -
- + + Error - + @@ -231,8 +231,11 @@ - - - - + + + + + +
+ Index: openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-add-edit.tcl,v diff -u -r1.28 -r1.29 --- openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 20 Apr 2004 21:12:20 -0000 1.28 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 27 Apr 2004 00:49:29 -0000 1.29 @@ -36,7 +36,7 @@ task_item_id:array,optional task_title:array,optional {process_id:integer ""} - description:array,optional + description:html,array,optional name:array,optional end_date:array,optional percent_complete:array,optional @@ -50,6 +50,7 @@ dependency_task_id:array,optional skip_task_p:array,optional {using_process_p "f"} + {return_url ""} } -properties { @@ -90,6 +91,7 @@ set package_id [ad_conn package_id] + # --------------------------------------------------------------- # # terminology # --------------------------------------------------------------- # @@ -105,6 +107,12 @@ } + +# ns_log Notice "return_url: $return_url" + + + + # -------------------------------------------------------------------- # If we are using a process, then we need to get the information on # the process now. This is necessary because we need to do things like @@ -128,12 +136,27 @@ set estimated_hours_work_max_v($process_tid) $estimated_hours_work_max set dependency_v($process_tid) $process_parent_task + # make sure that we don't have empty values for estimated + # hours work + if {[empty_string_p $estimated_hours_work_v($process_tid)]} { + set estimated_hours_work_v($process_tid) 0 + } + if {[empty_string_p $estimated_hours_work_min_v($process_tid)]} { + set estimated_hours_work_min_v($process_tid) 0 + } + if {[empty_string_p $estimated_hours_work_max_v($process_tid)]} { + set estimated_hours_work_max_v($process_tid) 0 + } + + lappend process_tasks $process_tid } set number [llength $process_tasks] } + + # --------------------------------------------------------------- # @@ -205,19 +228,72 @@ set keyname [array nextelement end_date $searchToken] set keyvalu $end_date($keyname) + # ns_log Notice "keyname: $keyname keyvalu: $keyvalu" + # element_num is 1...n, element_type is year, format, day, month regexp {(.*)\.(.*)} $keyname match element_num element_type + # ns_log Notice "element_num: $element_num element_type: $element_type" + set end_date_[set element_type]($element_num) $keyvalu + # ns_log notice "set end_date_[set element_type] to $keyvalu" } for {set i 1} {$i <= $number} {incr i} { # set up date variable names set end_date_$i [list $end_date_year($i) $end_date_month($i) $end_date_day($i) {} {} {}] + # ns_log Notice "end_date_$i: [set end_date_$i]" } } +# ------------------------------------------------------- # +# The second evilest hack of all time. +# ------------------------------------------------------- +# This is a workaround the fact that using multiple richtext items +# with ad_form is extremely difficult. The description field +# will come in like an array, with values like +# description.1 = 1234 bold +# description.1.format = text/enhanced +# description.1.spellcheck = :nospell: +# The problem is we want +# to have multiple descriptions. +# +# What this loop does is go through the array, and rename the +# values into other variables. We then feed these variables into +# the SQL function that creates the new tasks. This works. I'm +# sure there must be a better way to do it. +# ------------------------------------------------------- # + +if {[info exists description] && ![exists_and_not_null process_id]} { + + set searchToken [array startsearch description] + + while {[array anymore description $searchToken]} { + + # these next two lines are important + set element_num "" + set element_type "" + + set keyname [array nextelement description $searchToken] + set keyvalu $description($keyname) + + # ns_log Notice "keyname: $keyname keyvalu: $keyvalu" + + # element_num is 1...n, element_type is format, spellcheck + regexp {(.*)\.(.*)} $keyname match element_num element_type + + # ns_log Notice "element_num: $element_num element_type: $element_type" + + set description_[set element_type]($element_num) $keyvalu + + # ns_log notice "set description_[set element_type] to $keyvalu" + + } + +} + + # --------------------------------------------------------------- # # permissions and title setup, etc # we should update the permissions to not just use package_id, so @@ -266,6 +342,10 @@ {value $task_id_pass} } + {return_url:text(hidden) + {value $return_url} + } + {project_id:text(hidden) {value $project_id} } @@ -281,6 +361,13 @@ # we set the values for edited tasks # ---------------------------------- + +# we set the initial value to 0, because we need at least one value to +# pass to SQL. Otherwise, when we do the IN (123, 234, 455), there +# won't be any values inside, and it will fail. +set my_dependencies [list 0] + + if {![ad_form_new_p -key task_id]} { set i 1 @@ -289,14 +376,34 @@ set task_title_arr($i) $my_task_title set description_arr($i) $my_description + set mime_type_arr($i) $my_mime_type + set template_arr($i) [list $my_description $my_mime_type] set estimated_hours_arr($i) $my_estimated_work set estimated_hours_min_arr($i) $my_estimated_work_min set estimated_hours_max_arr($i) $my_estimated_work_max - set end_date_arr($i) $my_end_date + + # We need the date to be in the right format in order to pass + # through the validate filter. + + # the end date comes in this format 2004 05 17 + # we need to get it in the {2004} {05} {17} {} {} {} format + regexp {(.*) (.*) (.*)} $my_end_date match year month day + if {[exists_and_not_null year]} { + set end_date_arr($i) "$year $month $day {} {} {}" + } else { + set end_date_arr($i) "{} {} {} {} {} {}" + } + set percent_complete_arr($i) $my_percent_complete set actual_hours_worked_arr($i) $my_actual_hours_worked set task_item_id_arr($i) [lindex $task_id [expr $i - 1]] set dependency_arr($i) $my_dependency + # we keep track of this to make sure that depedencies that + # are from closed tasks are still shown on the list of + # possible dependencies to select from + if {[exists_and_not_null my_dependency]} { + lappend my_dependencies $my_dependency + } # we are not using a process set process_task_id_arr($i) "" @@ -352,6 +459,8 @@ for {set i 1} {$i <= $number} {incr i} { set task_title_arr($i) "" set description_arr($i) "" + set mime_type_arr($i) "text/plain" + set template_arr($i) [list "" "text/plain"] set estimated_hours_arr($i) "0" set estimated_hours_min_arr($i) "0" set estimated_hours_max_arr($i) "0" @@ -534,15 +643,22 @@ # make sure we're not dependent on ourselves if {![string equal $task_item_id_arr($i) $dependency_options($key)]} { - append dependency_options_full "{\"$key\" $dependency_options($key)} " + # check for case when there is a quote in the name of + # a task. We have to filter this out, or we get an error. + append dependency_options_full "{{$key} $dependency_options($key)} " } } } else { foreach key $dependency_keys { - append dependency_options_full "{\"$key\" $dependency_options($key)} " + + # check for case when there is a quote in the name of + # a task. We have to filter this out, or we get an error. + append dependency_options_full "{{$key} $dependency_options($key)} " } } + # ns_log Notice "end_date.$i : $end_date_arr($i)" + ad_form -extend \ -name add_edit \ -form \ @@ -562,10 +678,10 @@ {value {$process_task_id_arr($i)}} \ ] \ [list \ - description.$i:text(textarea),optional \ + description.$i:richtext,optional,nospell \ {label "Description"} \ {html {rows 7 cols 40}} \ - {value {$description_arr($i)}} \ + {value {$template_arr($i)}} \ ] \ [list \ end_date.$i:date,to_sql(linear_date),optional \ @@ -587,21 +703,21 @@ {value {$dependency_arr($i)}} \ {help_text {$task_term the dependency is based on}} \ ] \ - ] + ] if {$use_uncertain_completion_times_p} { ad_form -extend \ -name add_edit \ -form \ [list \ [list \ - estimated_hours_work_min.$i:integer \ + estimated_hours_work_min.$i:text \ {label "Hours estimate - min"} \ {html {size 5}} \ {value {$estimated_hours_min_arr($i)}} \ ] \ [list \ - estimated_hours_work_max.$i:integer \ + estimated_hours_work_max.$i:text \ {label "Hours estimate - max"} \ {html {size 5}} \ {value {$estimated_hours_max_arr($i)}} \ @@ -612,7 +728,7 @@ -form \ [list \ [list \ - estimated_hours_work.$i:integer \ + estimated_hours_work.$i:text \ {label "Hours estimate"} \ {html {size 5}} \ {value {$estimated_hours_arr($i)}} \ @@ -623,6 +739,7 @@ + ad_form -extend -name add_edit -select_query_name task_query -on_submit { set user_id [ad_conn user_id] @@ -652,12 +769,19 @@ if {![exists_and_not_null end_date_$i]} { - set end_date_$i [db_null] + set end_date_$i "{} {} {} {} {} {}" } # set up variables, pulling from arrays set p_task_title $task_title($i) + set p_description $description($i) + + # ns_log Notice "Format: $description_format($i)" + + + set p_mime_type $description_format($i) + set p_work $estimated_hours_work($i) set p_work_min $estimated_hours_work_min($i) set p_work_max $estimated_hours_work_max($i) @@ -666,21 +790,16 @@ set p_parent_task_id $dependency_task_id($i) set p_skip_p $skip_task_p($i) - ns_log Notice "end date: $p_end_date" + # ns_log Notice "end date: $p_end_date" - # Make sure we do not insert bogus stuff into the database. - - if {$p_end_date == "{} {} {} {} {} {}"} { - set p_end_date [db_null] - } - # add in the new task if {[string equal $p_skip_p "f"]} { set this_revision_id [pm::task::new \ -project_id $project_item_id \ -title $p_task_title \ -description $p_description \ + -mime_type $p_mime_type \ -end_date $p_end_date \ -percent_complete "0" \ -estimated_hours_work $p_work \ @@ -692,8 +811,6 @@ set this_task_id [db_string get_task_item_id {}] - - set dependent_task_id($i) $this_task_id if {[exists_and_not_null p_parent_task_id]} { @@ -751,8 +868,6 @@ } - pm::project::compute_parent_status $project_item_id - } -edit_data { set timestamp_ansi [db_string get_today " @@ -785,6 +900,8 @@ set p_task_item_id $task_item_id($i) set p_task_title $task_title($i) set p_description $description($i) + set p_mime_type $description_format($i) + set p_percent $percent_complete($i) set p_work $estimated_hours_work($i) set p_work_min $estimated_hours_work_min($i) @@ -828,6 +945,7 @@ -project_item_id $project_item_id \ -title $p_task_title \ -description $p_description \ + -mime_type $p_mime_type \ -end_date "[set end_date_[set i]]" \ -percent_complete $p_percent \ -estimated_hours_work $p_work \ @@ -855,11 +973,13 @@ } - pm::project::compute_parent_status $project_item_id - } -after_submit { - ad_returnredirect "task-assign-add-edit?[export_vars -url {project_item_id process_task_id:multiple revisions:multiple task_id:multiple}]" + # ns_log Notice "tae: return_url: $return_url" + + ad_returnredirect "task-assign-add-edit?[export_vars -url {project_item_id return_url process_task_id:multiple revisions:multiple task_id:multiple}]" + pm::project::compute_parent_status $project_item_id + ad_script_abort } Index: openacs-4/contrib/packages/project-manager/www/task-assign-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-assign-add-edit-postgresql.xql,v diff -u -r1.6 -r1.7 --- openacs-4/contrib/packages/project-manager/www/task-assign-add-edit-postgresql.xql 20 Apr 2004 21:12:21 -0000 1.6 +++ openacs-4/contrib/packages/project-manager/www/task-assign-add-edit-postgresql.xql 27 Apr 2004 00:49:29 -0000 1.7 @@ -1,5 +1,6 @@ + select @@ -21,7 +22,6 @@ title as one_line, description, item_id, - to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as end_date_ansi, estimated_hours_work, estimated_hours_work_min, estimated_hours_work_max, Index: openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-assign-add-edit.adp,v diff -u -r1.5 -r1.6 --- openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.adp 12 Mar 2004 13:44:45 -0000 1.5 +++ openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.adp 27 Apr 2004 00:49:29 -0000 1.6 @@ -1,5 +1,5 @@ - - @context_bar;noquote@ + + @context@ @title@ @@ -40,7 +40,7 @@

- + Index: openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-assign-add-edit.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.tcl 20 Apr 2004 21:12:21 -0000 1.9 +++ openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.tcl 27 Apr 2004 00:49:29 -0000 1.10 @@ -6,7 +6,7 @@ @creation-date 2003-09-10 @cvs-id $Id$ - @return context_bar Context bar. + @return context Context bar. @return title Page title. @return num a multirow that contains the number of assignments @return tasks a multirow that contains the ticket info @@ -18,17 +18,18 @@ my_key:integer,optional {process_task_id:multiple,optional ""} - task_id:multiple,optional + {task_id:multiple,optional ""} revisions:multiple {project_item_id:integer ""} role_id:array,optional party_id:array,optional + {return_url ""} } -properties { tasks:multirow num:multirow - context_bar:onevalue + context:onevalue title:onevalue task_term_lower:onevalue project_item_id:onevalue @@ -38,20 +39,39 @@ # --------------------------------------------------------------- # +if {[string equal [llength task_id] 1] && [exists_and_not_null return_url]} { + + # if the task is closed, then we don't need to reassign things + if {[string equal 0 [pm::task::open_p -task_item_id $task_id]]} { + ad_returnredirect $return_url + } +} + # hack to get around lack of multiple hidden support with ad_form set process_task_id [string map {"-" " "} $process_task_id] set revisions [string map {"-" " "} $revisions] set task_id [string map {"-" " "} $task_id] + +# The number of assignments is set to 9, or the number of assignees + +# 2 if there are more than 5 assignees +set NUMBER_OF_ASSIGNMENTS 9 + +# find out the maximum number of assignees +db_foreach get_count "select count(task_id) as my_count from pm_task_assignment where task_id in ([join $task_id ", "]) group by task_id" { + if {$my_count > $NUMBER_OF_ASSIGNMENTS} { + set NUMBER_OF_ASSIGNMENTS [expr $my_count + 2] + } +} + db_multirow tasks get_task_info { } # create a multirow we can use to iterate template::multirow create num number -# currently hardcoded the number of assignments -for {set i 0} {$i <= 5} {incr i} { +for {set i 0} {$i <= $NUMBER_OF_ASSIGNMENTS} {incr i} { template::multirow append num $i } @@ -74,7 +94,7 @@ # permissions set title "Add $task_term_lower assignments" -set context_bar [ad_context_bar [list "one?project_item_id=$project_item_id" "One $project_term"] "New $task_term dependency"] +set context [list [list "one?project_item_id=$project_item_id" "One $project_term"] "New $task_term dependency"] permission::require_permission -party_id $user_id -object_id $package_id -privilege create @@ -96,6 +116,10 @@ {process_task_id:text(hidden) {value $process_task_id_pass}} + {return_url:text(hidden) + {value $return_url} + } + {revisions:text(hidden) {value $revisions_pass}} @@ -113,17 +137,15 @@ } -new_data { - #role_id - #party_id - + # we have to decode these items back into lists set process_task_id [string map {"-" " "} $process_task_id] set revisions [string map {"-" " "} $revisions] set task_id [string map {"-" " "} $task_id] + # we get more information about the tasks, for notification purposes db_foreach get_more_task_info {} { set one_lines($item_id) $one_line set descriptions($item_id) $description - set end_dates_pretty($item_id) [lc_time_fmt $end_date_ansi "%x"] set est_hours_work($item_id) $estimated_hours_work set est_hours_work_min($item_id) $estimated_hours_work_min set est_hours_work_max($item_id) $estimated_hours_work_max @@ -197,6 +219,11 @@ set role_oneline($val) $des } + # ideally, we want to replace this with notifications, but I never + # got it working correctly, so I use acs_mail_lite + + set from_address [db_string get_email "select email from parties where party_id = :user_id"] + foreach pl $party_list { regexp {(.*),(.*)} $pl match task_id_v num_value @@ -205,8 +232,12 @@ set r_id $assignment_role($pl) set p_id $assignment_party($pl) - set subject "New Task \#$t_id: $one_lines($t_id)" + set to_address [db_string get_email "select email from parties where party_id = :p_id"] + set subject "Task \#$t_id: $one_lines($t_id)" + + set task_url "[parameter::get_from_package_key -package_key acs-kernel -parameter SystemURL][ad_conn package_url]task-one?task_id=$t_id" + if {[string equal $use_uncertain_completion_times_p 1]} { set estimated_work " Hrs work (min): $est_hours_work_min($t_id) @@ -223,6 +254,7 @@ Description: $one_lines($t_id) Project: $project_name Your role: $role_oneline($r_id) +Link: $task_url --------------- Estimated work: @@ -231,7 +263,6 @@ ------ Dates: ------ -Deadline: [ad_decode $end_dates_pretty($t_id) "" "None" $end_dates_pretty($t_id)] Earliest start: $earliest_starts($item_id) Earliest finish: $earliest_finishes($item_id) Latest start: $latest_starts($item_id) @@ -242,26 +273,37 @@ ----------- $descriptions($t_id)" - #notification::request::new \ - # -type_id "[notification::type::get_type_id -short_name pm_task_notif]" \ - # -object_id $t_id \ - # -user_id $p_id \ - # -interval_id [notification::interval::get_id_from_name -name instant] \ - # -delivery_method_id [notification::delivery::get_id -short_name email] - notification::new \ - -type_id [notification::type::get_type_id -short_name pm_task_notif] \ - -object_id $t_id \ - -response_id $t_id \ - -notif_subject $subject \ - -notif_text $notification_text + acs_mail_lite::send \ + -to_addr $to_address \ + -from_addr $from_address \ + -subject $subject \ + -body $notification_text + # we only want to do this for new people + # notification::request::new \ + # -type_id "[notification::type::get_type_id -short_name pm_task_notif]" \ + # -object_id $t_id \ + # -user_id $p_id \ + # -interval_id [notification::interval::get_id_from_name -name instant] \ + # -delivery_method_id [notification::delivery::get_id -short_name email] + + # send out notifications + # notification::new \ + # -type_id [notification::type::get_type_id -short_name pm_task_notif] \ + # -object_id $t_id \ + # -response_id $t_id \ + # -notif_subject $subject \ + # -notif_text $notification_text + db_dml add_assignment { } } } -edit_data { + # I believe this block is never executed. + # do something #role_id #party_id @@ -334,7 +376,11 @@ } -after_submit { - ad_returnredirect "one?project_item_id=$project_item_id" + if {[exists_and_not_null return_url]} { + ad_returnredirect $return_url + } else { + ad_returnredirect "one?project_item_id=$project_item_id" + } ad_script_abort } @@ -359,12 +405,19 @@ lappend users_values $pid } + } + + # if nobody is assigned to this task yet, we want to, by default, + # add in the person entering the task (as a watcher) + if {[llength $users_values] < 1} { + lappend users_values [ad_conn user_id] + lappend roles_values [db_string get_watcher "select role_id from pm_roles where is_observer_p = 't' limit 1"] } set users_length [string length $users_values] set roles_length [string length $roles_values] - for {set i 0} {$i <= 5} {incr i} { + for {set i 0} {$i <= $NUMBER_OF_ASSIGNMENTS} {incr i} { if {$i < $users_length && $i < $roles_length} { set uv [lindex $users_values $i] Index: openacs-4/contrib/packages/project-manager/www/task-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-delete.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/task-delete.adp 27 Apr 2004 00:49:29 -0000 1.1 @@ -0,0 +1,5 @@ + + @title@ + @context@ + +Currently, deletion of a task is not working. Index: openacs-4/contrib/packages/project-manager/www/task-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/task-delete.tcl 27 Apr 2004 00:49:29 -0000 1.1 @@ -0,0 +1,19 @@ +# + +ad_page_contract { + + Deletes a task + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-03-31 + @arch-tag: af0efc2f-cf78-4f80-a484-1f52f3db6a48 + @cvs-id $Id: task-delete.tcl,v 1.1 2004/04/27 00:49:29 jader Exp $ +} { + task_item_id:integer +} -properties { +} -validate { +} -errors { +} + +set title "Delete task" +set context [list "Delete task"] Index: openacs-4/contrib/packages/project-manager/www/task-one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-one-postgresql.xql,v diff -u -r1.19 -r1.20 --- openacs-4/contrib/packages/project-manager/www/task-one-postgresql.xql 12 Mar 2004 13:44:45 -0000 1.19 +++ openacs-4/contrib/packages/project-manager/www/task-one-postgresql.xql 27 Apr 2004 00:49:29 -0000 1.20 @@ -18,6 +18,7 @@ t.item_id, t.title as task_title, t.description, + t.mime_type, to_char(t.end_date,'Mon DD ''YY') as end_date, to_char(t.earliest_start,'Mon DD ''YY') as earliest_start, to_char(t.earliest_start,'J') as earliest_start_j, @@ -51,7 +52,9 @@ t.revision_id, i.live_revision, t.title as task_title, - t.description || ' -- ' || p.first_names || ' ' || p.last_name as description, + t.description || ' -- ' || p.first_names || ' ' || p.last_name + as description, + t.mime_type, to_char(t.end_date,'MM/DD/YYYY') as end_date, t.percent_complete, t.estimated_hours_work_min, @@ -145,7 +148,7 @@ pm_task_xref x, pm_tasks_revisionsx r, cr_items i WHERE x.task_id_2 = :task_id and - x.task_id_2 = r.item_id and + x.task_id_1 = r.item_id and r.revision_id = i.live_revision UNION SELECT @@ -166,7 +169,7 @@ pm_task_xref x2, pm_tasks_revisionsx r2, cr_items i2 WHERE x2.task_id_1 = :task_id and - x2.task_id_1 = r2.item_id and + x2.task_id_2 = r2.item_id and i2.live_revision = r2.revision_id Index: openacs-4/contrib/packages/project-manager/www/task-one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-one.adp,v diff -u -r1.23 -r1.24 --- openacs-4/contrib/packages/project-manager/www/task-one.adp 12 Mar 2004 13:44:45 -0000 1.23 +++ openacs-4/contrib/packages/project-manager/www/task-one.adp 27 Apr 2004 00:49:29 -0000 1.24 @@ -1,227 +1,236 @@ - - - - @task_term@ #@item_id@: @task_info.task_title@ + + @task_term@ #@item_id@: + @task_info.task_title@ @closed_message@ @context@ -

- -
+ + +
- - - - +
- - Edit - - - Print - -
- - - - - - - - + -
@task_term@ #@item_id@: @task_info.task_title@ - -
+
+ + Edit + + + Print + +
+ + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@task_term@ #@item_id@: @task_info.task_title@ + + + + +
-
Description
@task_info.description;noquote@
-- @task_info.creation_user@
Dates
Deadline@task_info.end_date@
Earliest start@task_info.earliest_start@
Earliest finish@task_info.earliest_finish@
Latest start@task_info.latest_start@
Latest finish@task_info.latest_start@
-
- -

- - - @notification_chunk;noquote@ - - -

- -
- - - - - - - - -
Assignees
- -
- -

- - - - - - - - -
@task_term@s this depends on.
- -
- -

- - - - - - - - -
@task_term@s depending on this @task_term@
- -
+ + + + + + + + + -

+

+ + + + + + + + + + + + + + + + + + + -
Description
@task_info.description;noquote@
-- @task_info.creation_user@
@comments;noquote@ +

+ @comments_link;noquote@ +

Dates
- - - - - - -
Related @task_term@s
- -
+ + Deadline + @task_info.end_date@ + + + + Earliest start + @task_info.earliest_start@ + + + + Earliest finish + @task_info.earliest_finish@ + + + + Latest start + @task_info.latest_start@ + + + + Latest finish + @task_info.latest_start@ + + + + + +

+ + + + @notification_chunk;noquote@ + + + + + +   + + -

- - - - - +
Logged hours
+ + + + + + +
Assignees
+ +
- - - Total work: - - @task_info.estimated_hours_work_min@ - - @task_info.estimated_hours_work_max@ hrs estimated +

+ + + + + + + + +
@task_term@s this depends on.
+ +
+ +

+ + + + + + + + +
@task_term@s depending on this @task_term@
+ +
+ +

+ + + + + + + + +
Related @task_term@s
+ +
+ +

+ + + + + + + + - - - - - - - - - - - - - - - - -
Logged hours
+ Total work: + + @task_info.estimated_hours_work_min@ - + @task_info.estimated_hours_work_max@ hrs estimated - - @task_info.estimated_hours_work@ hrs estimated - - - @task_info.percent_complete@% complete
- - Slack: @task_info.slack_time@
-
- - Slack: n/a - -
- - Log hours - - - @log_note@ -
- -
- -

- -
+ + @task_info.estimated_hours_work@ hrs estimated + + + + + @task_info.percent_complete@% complete
+ + Slack: @task_info.slack_time@
+
+ + Slack: n/a + + + + + + + + + Log hours + + + + + @log_note@ + + + + + + + + + + + + + + + +
- - +

Revisions

+

- - @comments;noquote@ -

- @comments_link;noquote@ - +

Index: openacs-4/contrib/packages/project-manager/www/task-one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-one.tcl,v diff -u -r1.24 -r1.25 --- openacs-4/contrib/packages/project-manager/www/task-one.tcl 12 Mar 2004 13:44:45 -0000 1.24 +++ openacs-4/contrib/packages/project-manager/www/task-one.tcl 27 Apr 2004 00:49:29 -0000 1.25 @@ -26,6 +26,7 @@ orderby_dependency:optional orderby_dependency2:optional } -properties { + closed_message:onevalue notification_chunk:onevalue task_info:onerow project_item_id:onevalue @@ -93,7 +94,6 @@ set comments_link [general_comments_create_link -object_name pm_task -link_text "Add a comment" -context_id $package_id $task_id "[ad_conn url]?task_id=$task_id"] - # permissions permission::require_permission -party_id $user_id -object_id $package_id -privilege read @@ -105,15 +105,30 @@ # Task info ---------------------------------------------------------- db_1row task_query { } -column_array task_info -set task_info(description) [ad_text_to_html -- $task_info(description)] +set richtext_list [list $task_info(description) $task_info(mime_type)] + +set task_info(description) [template::util::richtext::get_property html_value $richtext_list] + if {[exists_and_not_null task_info(earliest_start_j)]} { set task_info(slack_time) [pm::task::slack_time \ -earliest_start_j $task_info(earliest_start_j) \ -today_j $task_info(today_j) \ -latest_start_j $task_info(latest_start_j)] } +if {$task_info(percent_complete) >= 100} { + set closed_message "-- Closed" +} else { + set closed_message "" +} + +# how to get back here +set return_url "[ad_conn url]?[ad_conn query]" + +set task_edit_url "task-add-edit?my_key=1&task_id=$task_id&project_item_id=$project_item_id&return_url=$return_url" + + set logger_project [pm::project::get_logger_project \ -project_item_id $project_item_id] set logger_variable_id [logger::variable::get_default_variable_id] @@ -149,6 +164,9 @@ } description { label "Description" + display_template { + @revisions.description_rich;noquote@ + } } percent_complete { label "Status" @@ -186,9 +204,14 @@ } -db_multirow -extend { item_url } revisions task_revisions_query { +db_multirow -extend { item_url description_rich } revisions task_revisions_query { } { set item_url [export_vars -base "task-one" -override {{task_revision_id $revision_id}} -exclude {revision_id} { revision_id task_id}] + + set richtext_list [list $description $mime_type] + + set description_rich [template::util::richtext::get_property html_value $richtext_list] + } # Dependency info ------------------------------------------------ @@ -323,7 +346,7 @@ -elements { first_names { label { - Who + Who } display_template { @people.user_info@ @@ -388,7 +411,10 @@ label "LS" } latest_finish_pretty { - label "ES" + label "LF" + display_template { + @xrefs.latest_finish_pretty@ + } } } \ -sub_class { Index: openacs-4/contrib/packages/project-manager/www/task-print-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-print-postgresql.xql,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/project-manager/www/task-print-postgresql.xql 12 Mar 2004 13:44:45 -0000 1.3 +++ openacs-4/contrib/packages/project-manager/www/task-print-postgresql.xql 27 Apr 2004 00:49:29 -0000 1.4 @@ -31,6 +31,7 @@ t.item_id, t.title as task_title, t.description, + t.mime_type, to_char(t.end_date,'Mon DD ''YY') as end_date, to_char(t.earliest_start,'Mon DD ''YY') as earliest_start, to_char(t.earliest_start,'J') as earliest_start_j, @@ -99,7 +100,7 @@ select r.one_line, - u.first_names || ' ' || u.last_name || ' (' || u.email || ')' as user_info, + u.first_names || ' ' || u.last_name as user_info, r.role_id from pm_task_assignment a, Index: openacs-4/contrib/packages/project-manager/www/task-print.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-print.adp,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/project-manager/www/task-print.adp 12 Mar 2004 13:44:45 -0000 1.3 +++ openacs-4/contrib/packages/project-manager/www/task-print.adp 27 Apr 2004 00:49:29 -0000 1.4 @@ -91,8 +91,13 @@
-
+
-@comments;noquote@ + + @comments;noquote@ + + + @show_comment_link;noquote@ + -
+
Index: openacs-4/contrib/packages/project-manager/www/task-print.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-print.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/project-manager/www/task-print.tcl 12 Mar 2004 13:44:45 -0000 1.3 +++ openacs-4/contrib/packages/project-manager/www/task-print.tcl 27 Apr 2004 00:49:29 -0000 1.4 @@ -25,6 +25,7 @@ orderby_revisions:optional orderby_dependency:optional orderby_dependency2:optional + {show_comment_p "f"} } -properties { task_info:onerow @@ -79,6 +80,7 @@ set comments_link [general_comments_create_link -object_name pm_task -link_text "Add a comment" -context_id $package_id $task_id "[ad_conn url]?task_id=$task_id"] +set show_comment_link "show comments" # permissions @@ -90,7 +92,10 @@ # Task info ---------------------------------------------------------- db_1row task_query { } -column_array task_info -set task_info(description) [ad_text_to_html -- $task_info(description)] +if {[string equal $task_info(mime_type) "text/plain"]} { + set task_info(description) [ad_text_to_html -- $task_info(description)] +} + set task_info(slack_time) [pm::task::slack_time \ -earliest_start_j $task_info(earliest_start_j) \ -today_j $task_info(today_j) \ Index: openacs-4/contrib/packages/project-manager/www/task-select-project-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-select-project-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/project-manager/www/task-select-project-postgresql.xql 12 Mar 2004 13:44:45 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/task-select-project-postgresql.xql 27 Apr 2004 00:49:29 -0000 1.3 @@ -5,13 +5,14 @@ SELECT p.item_id as project_item_id, - p.title as project_name + p.title as project_name, + p.description as description FROM pm_projectsx p, cr_items i, pm_project_status s WHERE p.project_id = i.live_revision and p.parent_id = :root_folder and p.status_id = s.status_id and s.status_type = 'o' - ORDER BY p.title + ORDER BY upper(p.title) Index: openacs-4/contrib/packages/project-manager/www/task-select-project.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-select-project.adp,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/project-manager/www/task-select-project.adp 10 Nov 2003 19:34:54 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/task-select-project.adp 27 Apr 2004 00:49:29 -0000 1.3 @@ -2,7 +2,4 @@ @context_bar;noquote@ @title@ -@form_definition_beg;noquote@ - @select_widget;noquote@ - -@form_definition_end;noquote@ +@choices;noquote@ Index: openacs-4/contrib/packages/project-manager/www/task-select-project.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-select-project.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/project-manager/www/task-select-project.tcl 26 Jan 2004 15:39:40 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/task-select-project.tcl 27 Apr 2004 00:49:29 -0000 1.3 @@ -14,15 +14,13 @@ } { {process_id:integer ""} - + {return_url ""} + } -properties { context_bar:onevalue title:onevalue - select_widget:onevalue - select_widget_name:onevalue - form_definition_beg:onevalue - form_definition_end:onevalue + choices:onevalue } -validate { } -errors { @@ -36,11 +34,11 @@ # terminology set project_term [parameter::get -parameter "ProjectName" -default "Project"] set task_term [parameter::get -parameter "TaskName" -default "Task"] -set task_term_lower [parameter::get -parameter "taskname" -default "task"] -set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] +# set task_term_lower [parameter::get -parameter "taskname" -default "task"] +# set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] -set title "Edit a $task_term_lower" +set title "Select a $project_term to assign this $task_term to" if {[exists_and_not_null process_id]} { set context_bar [ad_context_bar [list "processes" "Processes"] "Use"] @@ -54,17 +52,12 @@ set root_folder [db_string get_root "select pm_project__get_root_folder (:package_id, 'f')"] -set select_widget_name project_item_id -set select_widget "" -set form_definition_beg "
" -append form_definition_beg [export_vars -form {process_id}] -set form_definition_end "
" - Index: openacs-4/contrib/packages/project-manager/www/tasks-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/tasks-postgresql.xql,v diff -u -r1.5 -r1.6 --- openacs-4/contrib/packages/project-manager/www/tasks-postgresql.xql 12 Mar 2004 13:44:45 -0000 1.5 +++ openacs-4/contrib/packages/project-manager/www/tasks-postgresql.xql 27 Apr 2004 00:49:29 -0000 1.6 @@ -6,10 +6,12 @@ SELECT ts.task_id, + ts.task_id as item_id, ts.task_number, t.task_revision_id, t.title, t.description, + t.parent_id as project_item_id, to_char(t.earliest_start,'J') as earliest_start_j, to_char(current_timestamp,'J') as today_j, to_char(t.latest_start,'J') as latest_start_j, @@ -29,13 +31,16 @@ (select one_line from pm_roles r where ta.role_id = r.role_id) as role FROM pm_tasks ts, + cr_items i, pm_tasks_revisionsx t LEFT JOIN pm_task_assignment ta ON t.item_id = ta.task_id LEFT JOIN persons p ON ta.party_id = p.person_id WHERE - ts.task_id = t.item_id + ts.task_id = t.item_id and + i.item_id = t.item_id and + t.task_revision_id = i.live_revision [template::list::filter_where_clauses -and -name tasks] [template::list::orderby_clause -orderby -name tasks] Index: openacs-4/contrib/packages/project-manager/www/tasks.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/tasks.adp,v diff -u -r1.5 -r1.6 --- openacs-4/contrib/packages/project-manager/www/tasks.adp 12 Mar 2004 13:44:45 -0000 1.5 +++ openacs-4/contrib/packages/project-manager/www/tasks.adp 27 Apr 2004 00:49:29 -0000 1.6 @@ -1,7 +1,7 @@ - + @task_term@s @context@ @@ -11,14 +11,15 @@ - + My tasks
Other tasks

- +

- Search:
- + Search:
+ + @hidden_vars;noquote@
Index: openacs-4/contrib/packages/project-manager/www/tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/tasks.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/contrib/packages/project-manager/www/tasks.tcl 12 Mar 2004 13:44:45 -0000 1.5 +++ openacs-4/contrib/packages/project-manager/www/tasks.tcl 27 Apr 2004 00:49:29 -0000 1.6 @@ -24,8 +24,14 @@ task_term:onevalue context:onevalue tasks:multirow + hidden_vars:onevalue } +# if someone clicks on a party, then we want to see those tasks. +if {[exists_and_not_null party_id]} { + set mine_p "f" +} + # --------------------------------------------------------------- # # terminology @@ -34,6 +40,12 @@ set project_term [parameter::get -parameter "ProjectName" -default "Project"] set project_term_lower [parameter::get -parameter "projectname" -default "project"] + +set exporting_vars { status_id party_id orderby mine_p } +set hidden_vars [export_vars -form $exporting_vars] +# how to get back here +set return_url "[ad_conn url]?[ad_conn query]" + # set up context bar set context [list "Tasks"] @@ -60,6 +72,18 @@ # Tasks, using list-builder --------------------------------- +if {![empty_string_p $searchterm]} { + + if {[regexp {([0-9]+)} $searchterm match query_digits]} { + set search_term_where " (upper(t.title) like upper('%$searchterm%') + or t.item_id = :query_digits) " + } else { + set search_term_where " upper(t.title) like upper('%$searchterm%')" + } +} else { + set search_term_where "" +} + template::list::create \ -name tasks \ -multirow tasks \ @@ -87,26 +111,60 @@ } latest_finish_pretty { label "Latest Finish" + display_template { + @tasks.latest_finish_pretty@ + } } actual_hours_worked { label "Hours completed" - display_template "@tasks.actual_hours_worked@/@tasks.estimated_hours_work@" + display_template "@tasks.actual_hours_worked@/@tasks.estimated_hours_work@ (@tasks.percent_complete@\%)" } + project_item_id { + label "P" + display_template "P" + } + log_url { + label "L" + display_template {L} + } } \ - -actions { - "Add task" "task-select-project" "Add a task" + -actions [list "Add task" [export_vars -base task-select-project {return_url}] "Add a task"] \ + -bulk_actions { + "Log hours" "log-bulk" "Log hours for several tasks" } \ + -bulk_action_export_vars { + {return_url} + } \ -sub_class { narrow } \ -filters { searchterm { label "Search" + where_clause {$search_term_where} } party_id { label "People" - values {[db_list_of_lists get_people "select distinct(first_names || ' ' || last_name) as fullname, u.person_id from persons u, pm_task_assignment a where u.person_id = a.party_id order by fullname"]} + values {[db_list_of_lists get_people " + SELECT + distinct(first_names || ' ' || last_name) as fullname, + u.person_id + FROM + persons u, + pm_task_assignment a, + cr_items t, + pm_tasks ts, + pm_tasks_revisionsx r + WHERE + u.person_id = a.party_id and + t.item_id = a.task_id and + t.item_id = ts.task_id and + ts.status = :status_id and + t.item_id = r.item_id and + t.live_revision = r.revision_id + ORDER BY + fullname"]} where_clause { ta.party_id = :party_id } @@ -178,10 +236,14 @@ } -db_multirow -extend { item_url latest_start_pretty latest_finish_pretty slack_time} tasks tasks { + + +db_multirow -extend { item_url latest_start_pretty latest_finish_pretty slack_time log_url} tasks tasks { } { set item_url [export_vars -base "task-one" {task_id}] + set log_url [export_vars -base "log" {{pm_task_id $task_id} {pm_project_id $project_item_id} {return_url $return_url}}] + set latest_start_pretty [lc_time_fmt $latest_start "%x"] set latest_finish_pretty [lc_time_fmt $latest_finish "%x"] Index: openacs-4/contrib/packages/project-manager/www/resources/print-16.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/resources/Attic/print-16.png,v diff -u Binary files differ