Index: openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/sql/postgresql/Attic/project-manager-create.sql,v
diff -u -r1.3.2.3 -r1.3.2.4
--- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-create.sql 13 Dec 2003 01:19:54 -0000 1.3.2.3
+++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-create.sql 10 Jan 2004 01:04:02 -0000 1.3.2.4
@@ -8,4 +8,5 @@
--
\i project-manager-table-create.sql
-\i project-manager-functions-create.sql
\ No newline at end of file
+\i project-manager-functions-create.sql
+\i project-manager-notifications-create.sql
Index: openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/sql/postgresql/Attic/project-manager-drop.sql,v
diff -u -r1.10.2.3 -r1.10.2.4
--- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-drop.sql 13 Dec 2003 01:19:54 -0000 1.10.2.3
+++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-drop.sql 10 Jan 2004 01:04:02 -0000 1.10.2.4
@@ -10,8 +10,6 @@
-- TASKS
--------
-\i project-manager-custom-drop.sql
-
-- task dependency types
drop table pm_task_dependency_types cascade;
drop table pm_task_dependency cascade;
@@ -145,6 +143,11 @@
drop sequence pm_project_status_seq;
drop table pm_project_status;
+drop table pm_project_category_map;
+
+drop sequence pm_project_category_seq;
+drop table pm_project_category;
+
select content_type__drop_type('pm_task', 't', 'f');
drop table pm_tasks cascade;
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.8.2.3 -r1.8.2.4
--- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql 13 Dec 2003 01:19:54 -0000 1.8.2.3
+++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql 10 Jan 2004 01:04:02 -0000 1.8.2.4
@@ -260,6 +260,9 @@
begin
raise NOTICE ''Deleting pm_project...'';
+ delete from acs_permissions
+ where object_id = p_project_id;
+
for v_child in select
item_id
from
@@ -599,6 +602,11 @@
declare
p_task_id alias for $1;
begin
+ -- will not work because permissions are on revision_id not
+ -- item_id
+ -- delete from acs_permissions
+ -- where object_id = p_task_id;
+
delete from pm_tasks_revisions
where task_revision_id in (select revision_id from pm_tasks_revisionsx where item_id = p_task_id);
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-notifications-create.sql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-notifications-drop.sql'.
Fisheye: No comparison available. Pass `N' to diff?
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.15.2.3 -r1.15.2.4
--- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-table-create.sql 13 Dec 2003 01:19:54 -0000 1.15.2.3
+++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-table-create.sql 10 Jan 2004 01:04:02 -0000 1.15.2.4
@@ -343,10 +343,10 @@
description varchar(1000)
);
-insert into pm_task_dependency_types (short_name, description) values ('start_before_start','Start before this starts');
-insert into pm_task_dependency_types (short_name, description) values ('start_before_finish','Start before this finishes');
-insert into pm_task_dependency_types (short_name, description) values ('finish_before_start','Finish before this starts');
-insert into pm_task_dependency_types (short_name, description) values ('finish_before_finish','Finish before this finishes');
+insert into pm_task_dependency_types (short_name, description) values ('start_before_start','Starts before this starts');
+insert into pm_task_dependency_types (short_name, description) values ('start_before_finish','Starts before this finishes');
+insert into pm_task_dependency_types (short_name, description) values ('finish_before_start','Finishes before this starts');
+insert into pm_task_dependency_types (short_name, description) values ('finish_before_finish','Finishes before this finishes');
create sequence pm_task_dependency_seq;
@@ -356,15 +356,21 @@
constraint pm_task_const_id_pk
primary key,
task_id integer
+ constraint pm_task_const_task_id_nn
+ not null
constraint pm_task_const_task_id_fk
references pm_tasks
on delete cascade,
parent_task_id integer
+ constraint pm_tasks_const_parent_id_nn
+ not null
constraint pm_tasks_const_parent_id_fk
references pm_tasks
on delete cascade,
dependency_type varchar
- constraint pm_tasks_const_type
+ constraint pm_tasks_const_type_nn
+ not null
+ constraint pm_tasks_const_type_fk
references pm_task_dependency_types,
constraint pm_task_dependency_uq
unique (task_id, parent_task_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.3 -r1.3.2.1
--- openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl 4 Sep 2003 23:18:23 -0000 1.3
+++ openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl 10 Jan 2004 01:04:02 -0000 1.3.2.1
@@ -12,7 +12,190 @@
namespace eval project_manager::project {}
+ad_proc -public project_manager::project::latest_start {
+ end_date_j
+ hours_to_complete
+ hours_day
+} {
+ # set latest_start($my_iid) [expr $task_deadline_j - [expr $activity_time($my_iid) / double($hours_day)]]
+
+ # we now set the latest start. This is equal to the
+ # latest finish date minus the amount of time it will
+ # take to accomplish the job. We need to disregard holidays!
+
+ set t_end_date $end_date_j
+ set t_today $t_end_date
+
+ while {![is_workday_p $t_today]} {
+ set t_today [expr $t_today - 1]
+ }
+ set t_total_hours $hours_to_complete
+
+ while {$t_total_hours > $hours_day} {
+
+ set t_today [expr $t_today - 1]
+
+ # if it is a holiday, don't subtract from total time
+
+ if {[is_workday_p $t_today]} {
+ set t_total_hours [expr $t_total_hours - $hours_day]
+ }
+
+ }
+
+ return $t_today
+
+}
+
+
+ad_proc -public project_manager::project::earliest_finish {
+ earliest_start_j
+ hours_to_complete
+ hours_day
+} {
+
+ # set earliest_finish($task_item) [expr $earliest_start($task_item) + [expr $activity_time($task_item) / double($hours_day)]]
+
+ # we now set the earliest finish. This is equal to the
+ # earliest start plus the amount of time it will
+ # take to accomplish the job. We need to disregard holidays!
+
+ set t_start_date $earliest_start_j
+ set t_today $t_start_date
+
+ while {![is_workday_p $t_today]} {
+ set t_today [expr $t_today + 1]
+ }
+ set t_total_hours $hours_to_complete
+
+ while {$t_total_hours > $hours_day} {
+
+ set t_today [expr $t_today + 1]
+
+ # if it is a holiday, don't subtract from total time
+
+ if {[is_workday_p $t_today]} {
+ set t_total_hours [expr $t_total_hours - $hours_day]
+ }
+
+ }
+
+ return $t_today
+
+}
+
+
+ad_proc -public project_manager::project::my_earliest_start {
+ earliest_start_j
+ hours_to_complete
+ hours_day
+} {
+ Computing the earliest start requires getting a max of all the possible
+ candidates. This returns the value for one candidate
+} {
+ # set my_earliest_start [expr [expr $activity_time($dependent_item) / double($hours_day)] + $earliest_start($dependent_item)]
+
+ set t_start_date $earliest_start_j
+ set t_today $t_start_date
+
+ while {![is_workday_p $t_today]} {
+ set t_today [expr $t_today + 1]
+ }
+
+ set t_total_hours $hours_to_complete
+
+ while {$t_total_hours > $hours_day} {
+
+ set t_today [expr $t_today + 1]
+
+ # if it is a holiday, don't subtract from total time
+
+ if {[is_workday_p $t_today]} {
+ set t_total_hours [expr $t_total_hours - $hours_day]
+ }
+
+ }
+
+ return $t_today
+
+}
+
+
+ad_proc -public project_manager::project::my_latest_finish {
+ latest_start_j
+ hours_to_complete
+ hours_day
+} {
+ Computing the latest
+} {
+ # set temp [expr $min_latest_start + [expr $activity_time($task_item) / double($hours_day)]]
+
+ set t_start_date $latest_start_j
+ set t_today $t_start_date
+
+ while {![is_workday_p $t_today]} {
+ set t_today [expr $t_today + 1]
+ }
+
+ set t_total_hours $hours_to_complete
+
+ while {$t_total_hours > $hours_day} {
+
+ set t_today [expr $t_today + 1]
+
+ # if it is a holiday, don't subtract from total time
+
+ if {[is_workday_p $t_today]} {
+ set t_total_hours [expr $t_total_hours - $hours_day]
+ }
+
+ }
+
+ return $t_today
+
+}
+
+
+ad_proc -public project_manager::project::julian_to_day_of_week {
+ julian_date
+} {
+ Computes the day of the week. 0=Sunday
+ Initially, I used Tcl's clock command, but it doesn't accept dates
+ larger than 2038, so I had to do this myself.
+} {
+ set date [dt_julian_to_ansi $julian_date]
+ regexp {([0-9]*)-([0-9]*)-([0-9]*)} $date match year month day
+ regexp {0(.)} $month match month extra
+ regexp {0(.)} $day match day extra
+ set alpha [expr [expr 14 - $month] / 12]
+ set y [expr $year - $alpha]
+ set m [expr $month + [expr 12 * $alpha] - 2]
+ set day_of_week_pre_mod [expr $day + $y + [expr $y / 4] - [expr $y / 100] + [expr $y / 400] + [expr 31 * $m / 12]]
+ set day_of_week [expr $day_of_week_pre_mod % 7]
+ return $day_of_week
+}
+
+ad_proc -public project_manager::project::is_workday_p {
+ date_j
+} {
+
+ Figures out whether or not a given date is a workday or not
+
+} {
+
+ # need to add in a table of holidays
+
+ set day_of_week [julian_to_day_of_week $date_j]
+
+ if {[string equal $day_of_week 6] || [string equal $day_of_week 0]} {
+ return 0
+ } else {
+ return 1
+ }
+}
+
+
ad_proc -public project_manager::project::compute_status {project_item_id} {
Looks at tasks and subprojects, and computes the current status of a project.
@@ -67,7 +250,7 @@
# --------------------------------------------------------------------
# for now, hardcode in a day is 8 hours. Later, we want to set this by
- # person. Note also that it assumes everyone works 7 days a week
+ # person.
# --------------------------------------------------------------------
set hours_day 8
@@ -97,6 +280,8 @@
set task_list [concat $task_list $task_list_project]
+ ns_log Notice "task_list: $task_list"
+
# -------------------------
# no tasks for this project
# -------------------------
@@ -112,6 +297,7 @@
# today_j (julian date for today)
db_1row tasks_group_query { }
+ ns_log notice "Julian today: $today_j"
# --------------------------------------------------------------
# Set up activity_time for all tasks
@@ -124,9 +310,12 @@
if {[exists_and_not_null task_deadline_j]} {
+ ns_log notice "$my_iid has a deadline $task_jdeadline_j"
+
set latest_finish($my_iid) $task_deadline_j
- set latest_start($my_iid) [expr $task_deadline_j - [expr $activity_time($my_iid) / double($hours_day)]]
+ set latest_start($my_iid) [latest_start $task_deadline_j $activity_time($my_iid) $hours_day]
+
}
}
@@ -145,7 +334,7 @@
set dependency_types($task_item_id-$parent_task_id) $dependency_type
- ns_log Notice "id: $dependency_id task: $task_item_id parent: $parent_task_id type: $dependency_type"
+ ns_log Notice "dependency (id: $dependency_id) task: $task_item_id parent: $parent_task_id type: $dependency_type"
}
@@ -190,7 +379,8 @@
if {![info exists depends($task_item)]} {
set earliest_start($task_item) $start_date_j
- set earliest_finish($task_item) [expr $earliest_start($task_item) + [expr $activity_time($task_item) / double($hours_day)]]
+ #set earliest_finish($task_item) [expr $earliest_start($task_item) + [expr $activity_time($task_item) / double($hours_day)]]
+ set earliest_finish($task_item) [earliest_finish $earliest_start($task_item) $activity_time($task_item) $hours_day]
lappend present_tasks $task_item
@@ -228,7 +418,7 @@
if {![exists_and_not_null earliest_start($task_item)]} {
- ns_log Notice " info exists for $task_item"
+ ns_log Notice " !info exists for $task_item"
# ---------------------------------------------
# set the earliest_start for this task =
@@ -237,19 +427,20 @@
# (i-1 means an item that this task depends on)
# ---------------------------------------------
- set max_earliest_start $today_j
+ set max_earliest_start 0
foreach dependent_item $depends($task_item) {
- set my_earliest_start [expr [expr $activity_time($dependent_item) / double($hours_day)] + $earliest_start($dependent_item)]
+ set my_earliest_start [my_earliest_start $earliest_start($dependent_item) $activity_time($dependent_item) $hours_day]
if {$my_earliest_start > $max_earliest_start} {
set max_earliest_start $my_earliest_start
}
}
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) [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 \
" earliest_start ($task_item): $earliest_start($task_item)"
@@ -327,10 +518,14 @@
# info for these items
# -----------------------------------------------------
+ ns_log Notice "Starting foreach task-item $task_list"
+
foreach task_item $task_list {
if {![info exists dependent($task_item)]} {
+ ns_log Notice " !info exists dependent($task_item)"
+
# we check this because some tasks already have
# hard deadlines set.
if {[info exists latest_finish($task_item)]} {
@@ -339,7 +534,8 @@
set latest_finish($task_item) $end_date_j
}
- set late_start_temp [expr $latest_finish($task_item) - [expr $activity_time($task_item) / double($hours_day)]]
+ #set late_start_temp [expr $latest_finish($task_item) - [expr $activity_time($task_item) / double($hours_day)]]
+ set late_start_temp [latest_start $latest_finish($task_item) $activity_time($task_item) $hours_day]
if {$late_start_temp < $latest_start($task_item)} {
set latest_start($task_item) $late_start_temp
@@ -348,12 +544,15 @@
} else {
set latest_finish($task_item) $end_date_j
- set latest_start($task_item) [expr $latest_finish($task_item) - [expr $activity_time($task_item) / double($hours_day)]]
+ #set latest_start($task_item) [expr $latest_finish($task_item) - [expr $activity_time($task_item) / double($hours_day)]]
+ set latest_start($task_item) [latest_start $latest_finish($task_item) $activity_time($task_item) $hours_day]
}
lappend present_tasks $task_item
ns_log Notice "Begin latest_start($task_item): $latest_start($task_item) latest_finish: $latest_finish($task_item)"
+ } else {
+ ns_log Notice " info exists dependent($task_item)"
}
}
@@ -381,7 +580,7 @@
ns_log Notice "this task_item: $task_item"
# -----------------------------------------------------
- # some tasks may already have latest_start filled in
+ # some tasks may already have latest_start filled in.
# the first run of tasks, for example, had their values
# filled in earlier
# -----------------------------------------------------
@@ -405,11 +604,15 @@
if {![exists_and_not_null latest_start($dependent_item)]} {
# let's not do this task_item yet
lappend future_tasks $task_item
+ ns_log Notice " defer"
set defer_p t
} else {
- set my_latest_start [expr $latest_start($dependent_item) - [expr $activity_time($dependent_item) / double($hours_day)]]
+ #set my_latest_start [expr $latest_start($dependent_item) - [expr $activity_time($dependent_item) / double($hours_day)]]
+ set my_latest_start [latest_start $latest_start($dependent_item) $activity_time($task_item) $hours_day]
+ ns_log Notice " my_latest_start: $my_latest_start"
+
if {$my_latest_start < $min_latest_start} {
set min_latest_start $my_latest_start
}
@@ -430,8 +633,12 @@
set latest_start($task_item) $min_latest_start
}
- set temp [expr $min_latest_start + [expr $activity_time($task_item) / double($hours_day)]]
+ ns_log Notice " min_latest_start: $min_latest_start"
+ # temp is temporary latest_finish
+ #set temp [expr $min_latest_start + [expr $activity_time($task_item) / double($hours_day)]]
+ set temp [my_latest_finish $min_latest_start $activity_time($task_item) $hours_day]
+
if {[exists_and_not_null latest_finish($task_item)]} {
if {$temp < $latest_finish($task_item)} {
set latest_finish($task_item)
@@ -517,8 +724,8 @@
set root_folder [db_exec_plsql get_root_folder { }]
- while {$parent_id != $root_folder} {
- set parent_id [db_string get_parent_id {}]
+ while {$parent_id != $root_folder && $parent_id != "-1"} {
+ set parent_id [db_string get_parent_id {} -default "-1"]
set last_item_id $my_item_id
set my_item_id $parent_id
}
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/tcl/task-procs-postgresql.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/tcl/task-procs.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
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.12.2.3 -r1.12.2.4
--- openacs-4/contrib/packages/project-manager/www/add-edit.tcl 13 Dec 2003 01:19:54 -0000 1.12.2.3
+++ openacs-4/contrib/packages/project-manager/www/add-edit.tcl 10 Jan 2004 01:04:02 -0000 1.12.2.4
@@ -125,7 +125,7 @@
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"}
- {html {size 4}} {value {$package_id $package_id}}
+ {html {size 4}} {value {}}
}
}
}
@@ -164,6 +164,8 @@
set project_id [db_exec_plsql new_project_item { *SQL* }]
set project_item_id [db_string get_item_id { }]
+ category::map_object -remove_old -object_id $project_item_id $category_ids
+
if {$use_project_customizations_p} {
ad_returnredirect "add-edit-2?[export_url_vars project_item_id project_id]"
ad_script_abort
Fisheye: Tag 1.3.2.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/www/dependency-add-edit-postgresql.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2.2.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/www/dependency-add-edit.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.6.2.4 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/www/dependency-add-edit.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
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.9.2.3 -r1.9.2.4
--- openacs-4/contrib/packages/project-manager/www/index.tcl 13 Dec 2003 01:19:54 -0000 1.9.2.3
+++ openacs-4/contrib/packages/project-manager/www/index.tcl 10 Jan 2004 01:04:02 -0000 1.9.2.4
@@ -18,7 +18,7 @@
orderby_project:optional
status_id:optional
category_id:multiple,optional
- {subprojects_p "f"}
+ {subprojects_p ""}
} -properties {
context:onevalue
@@ -57,6 +57,12 @@
# root CR folder
set root_folder [db_string get_root "select pm_project__get_root_folder (:package_id, 'f')"]
+# hack to make the subprojects filter work
+#if {[string equal $subprojects_p "t"]} {
+# set subprojects_p ""
+#}
+
+
# Projects, using list-builder ---------------------------------
@@ -116,8 +122,8 @@
earliest_finish_date {
label "Earliest finish"
}
- estimated_finish_date {
- label "Estimated Finish"
+ latest_finish_date {
+ label "Latest Finish"
}
actual_hours_completed {
label "Hours completed"
@@ -145,7 +151,9 @@
}
subprojects_p {
label Subprojects
- values {{"No" "f"} {"Yes" "t"}}
+ values {{"No" "f"} {"Yes" ""}}
+ default_value {f}
+ has_default_p 0
where_clause {p.parent_id = :root_folder}
}
category_id {
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.19.2.2 -r1.19.2.3
--- openacs-4/contrib/packages/project-manager/www/one-postgresql.xql 13 Dec 2003 01:19:54 -0000 1.19.2.2
+++ openacs-4/contrib/packages/project-manager/www/one-postgresql.xql 10 Jan 2004 01:04:02 -0000 1.19.2.3
@@ -86,10 +86,12 @@
t.title,
to_char(t.end_date,'YYYY-MM-DD HH24:MI') as end_date,
to_char(t.earliest_start,'YYYY-MM-DD HH24:MI') as earliest_start,
+ to_char(t.earliest_start,'J') as earliest_start_j,
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_start,'J') as latest_start_j,
+ to_char(current_date,'J') as today_j,
to_char(t.latest_finish,'YYYY-MM-DD HH24:MI') as latest_finish,
- to_char(t.latest_start-t.earliest_start,'DD') || ' days' as slack_time,
u.first_names,
u.last_name,
t.percent_complete,
@@ -100,11 +102,10 @@
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, cr_items i LEFT JOIN pm_task_dependency d ON i.item_id = d.task_id, all_users u
+ (select * from pm_tasks_revisionsx LEFT JOIN pm_task_assignment ON item_id = task_id) t LEFT JOIN all_users u ON t.party_id = u.party_id, cr_items i LEFT JOIN pm_task_dependency d ON i.item_id = d.task_id
WHERE
t.parent_id = :project_item_id and
- t.revision_id = i.live_revision and
- t.party_id = u.party_id
+ t.revision_id = i.live_revision
[template::list::orderby_clause -name tasks -orderby]
@@ -149,30 +150,6 @@
- SELECT
- p.target_rollout,
- p.bakery_id,
- f.name as bakery_name,
- p.customer_id,
- c.name as customer_name,
- p.brand_id,
- b.name as brand_name,
- p.product_type,
- p.finished_weight,
- p.distributor_id,
- d.name as distributor_name,
- p.region,
- p.ibr_formula_p,
- p.mix_ing_supplied_p,
- p.pkg_supplied_p
- FROM
- pm_projectsx p
- LEFT JOIN ibr_facility f ON p.bakery_id = f.ibr_facility_id
- LEFT JOIN organizations c ON p.customer_id = c.organization_id
- LEFT JOIN ibr_brand b ON p.brand_id = b.ibr_brand_id
- LEFT JOIN organizations d ON p.distributor_id = d.organization_id
- WHERE
- p.project_id = :original_project_id
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.27.2.3 -r1.27.2.4
--- openacs-4/contrib/packages/project-manager/www/one.adp 13 Dec 2003 01:19:54 -0000 1.27.2.3
+++ openacs-4/contrib/packages/project-manager/www/one.adp 10 Jan 2004 01:04:02 -0000 1.27.2.4
@@ -85,11 +85,6 @@
- Estimated finish |
- @project.estimated_finish_date@ |
-
-
-
Latest finish |
@project.latest_finish_date@ |
@@ -135,14 +130,6 @@
Project information |
-
-
-
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.26.2.3 -r1.26.2.4
--- openacs-4/contrib/packages/project-manager/www/one.tcl 13 Dec 2003 01:19:54 -0000 1.26.2.3
+++ openacs-4/contrib/packages/project-manager/www/one.tcl 10 Jan 2004 01:04:02 -0000 1.26.2.4
@@ -121,29 +121,22 @@
-multirow tasks \
-key task_id \
-elements {
+ task_id {
+ label "ID"
+ }
title {
label "Subject"
display_col title
- link_url_col item_url
- link_html { title "View this task" }
display_template {
- @tasks.title@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ @tasks.title@
}
}
+ parent_task_id {
+ label "Dep"
+ display_template {
+ @tasks.parent_task_id@
+ }
+ }
slack_time {
label "Slack"
display_template "@tasks.slack_time@"
@@ -197,7 +190,6 @@
earliest_start {orderby earliest_start}
earliest_finish {orderby earliest_finish}
latest_start {orderby latest_start}
- slack_time {orderby slack_time}
latest_finish {orderby latest_finish}
default_value latest_start,asc
} \
@@ -206,14 +198,25 @@
}
-db_multirow -extend { item_url earliest_start_pretty earliest_finish_pretty latest_start_pretty latest_finish_pretty} tasks project_tasks_query {
+db_multirow -extend { item_url earliest_start_pretty earliest_finish_pretty latest_start_pretty latest_finish_pretty slack_time} tasks project_tasks_query {
} {
set item_url [export_vars -base "task-one" { revision_id task_id}]
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]} {
+ if {$earliest_start_j < $today_j} {
+ set slack_time "[expr $latest_start_j - $today_j] days"
+ } else {
+ set slack_time "[expr $latest_start_j - $earliest_start_j] days"
+ }
+ } else {
+ set slack_time "n/a"
+ }
+
}
@@ -357,8 +360,6 @@
db_1row custom_query { } -column_array custom
-set custom(pretty_target_rollout) [lc_time_fmt $custom(target_rollout) "%x"]
-
# end of customizations
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.11.2.1 -r1.11.2.2
--- openacs-4/contrib/packages/project-manager/www/task-add-edit-postgresql.xql 4 Dec 2003 21:00:13 -0000 1.11.2.1
+++ openacs-4/contrib/packages/project-manager/www/task-add-edit-postgresql.xql 10 Jan 2004 01:04:02 -0000 1.11.2.2
@@ -105,4 +105,52 @@
+
+
+ select
+ short_name,
+ description
+ FROM
+ pm_task_dependency_types
+ ORDER BY
+ short_name
+
+
+
+
+
+ select
+ r.item_id,
+ r.title as task_title
+ FROM
+ pm_tasks_revisionsx r,
+ cr_items i
+ WHERE
+ r.parent_id = :project_item_id and
+ r.revision_id = i.live_revision
+ ORDER BY
+ upper(r.title)
+
+
+
+
+
+ INSERT INTO pm_task_dependency
+ (dependency_id, task_id, parent_task_id, dependency_type)
+ VALUES
+ (:dependency_id, :this_task_id, :parent_task_id, :p_dep_type)
+
+
+
+
+
+ select
+ item_id
+ FROM
+ pm_tasks_revisionsx
+ WHERE
+ revision_id = :this_revision_id
+
+
+
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.10.2.1 -r1.10.2.2
--- openacs-4/contrib/packages/project-manager/www/task-add-edit.adp 13 Dec 2003 01:19:54 -0000 1.10.2.1
+++ openacs-4/contrib/packages/project-manager/www/task-add-edit.adp 10 Jan 2004 01:04:02 -0000 1.10.2.2
@@ -18,7 +18,7 @@
|
- @num.rownum@ |
+ #@num.rownum@ |
Subject:*
@@ -48,9 +48,6 @@
Error
|
-
- |
- schedule constrained by other @task_term_lower@ |
Max: |
hrs
@@ -70,11 +67,6 @@
|
-
- |
- depends on another @task_term_lower@
- Error
- |
@@ -87,20 +79,34 @@
-
+
- Deadline:
+
+ Deadline:
-
+
+ Error
- Error
+
+
+ You may optionally enter a hard deadline
+ |
+
+ Dependency:
-
-
- You may optionally enter a hard deadline
+
+ Error
- |
+
+ Error
+
+
+ You may enter a @task_term_lower@ that needs to be completed before this @task_term_lower@
+ |
+
+
+
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.23.2.3 -r1.23.2.4
--- openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 13 Dec 2003 01:19:54 -0000 1.23.2.3
+++ openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 10 Jan 2004 01:04:02 -0000 1.23.2.4
@@ -24,7 +24,7 @@
@return num num is used as a multirow datasource to iterate over the ad_form elements
@return edit_p if t then we are editing. Used to show different portions of the form
- @param process_task_ids Specifies what process task ids were used if a process were used. We pass this on to future pages to determine things such as dependencies and assignments
+ @param process_task_ids Specifies what process task ids were used if a process were used. We pass this on to future pages to determine things such as assignments
@param project_item_id Specifies which project this task is associated with
@param project_id Specifies which project revision this task is associated with
@param number The number of Tasks to create
@@ -34,7 +34,6 @@
@param my_key if set, then ad_form knows that this is an edit
@param task_title
@param process_id The process we're using to create this task
- @param use_dependency_p Whether or not to use dependencies with this task
@param use_uncertain_completion_times_p Whether or not to use PERT-style completion time uncertainty 1 = yes
} {
@@ -44,11 +43,10 @@
project_id:integer,optional
{number:integer "1"}
task_revision_id:integer,optional
- task_id:integer,multiple,optional
+ {task_id ""}
task_item_id:array,optional
task_title:array,optional
{process_id:integer ""}
- use_dependency_p:array,optional
description:array,optional
name:array,optional
end_date:array,optional
@@ -57,6 +55,8 @@
estimated_hours_work:array,optional
estimated_hours_work_min:array,optional
estimated_hours_work_max:array,optional
+ dependency_type:array,optional
+ dependency_task_id:array,optional
} -properties {
@@ -124,13 +124,20 @@
set number [llength $process_tasks]
}
+# we use this to get around the lack of a hidden multiple in ad_form
+set task_id_pass [string map {"-" " "} $task_id]
+set task_id $task_id_pass
if {![ad_form_new_p -key task_id]} {
+ # Editing!
# -----------------------------------------------------
# create a multirow we can use to iterate
# we also set the number variable for future use
# -----------------------------------------------------
template::multirow create num number
+
+ # TODO:get task IDS
+ #
set i 1
set number 0
@@ -206,6 +213,8 @@
permission::require_permission -party_id $user_id -object_id $package_id -privilege create
}
+# we use this to pass through the task_ids
+set task_id_pass [string map {" " "-"} $task_id]
ad_form -name add_edit -form {
my_key:key(acs_object_id_seq)
@@ -214,6 +223,10 @@
{value $project_item_id}
}
+ {task_id:text(hidden)
+ {value $task_id_pass}
+ }
+
{project_id:text(hidden)
{value $project_id}
}
@@ -245,12 +258,6 @@
set actual_hours_worked_arr($i) $actual_hours_worked
set task_item_id_arr($i) [lindex $task_id [expr $i - 1]]
- if {[exists_and_not_null parent_task_id]} {
- set use_dependency_arr($i) [list checked ""]
- } else {
- set use_dependency_arr($i) ""
- }
-
# we are not using a process
set process_task_id_arr($i) ""
@@ -291,7 +298,6 @@
set estimated_hours_arr($i) "0"
set estimated_hours_min_arr($i) "0"
set estimated_hours_max_arr($i) "0"
- set use_dependency_arr($i) ""
set parent_arr($i) ""
set end_date_arr($i) ""
set percent_complete_arr($i) 0
@@ -309,12 +315,6 @@
set estimated_hours_min_arr($i) $estimated_hours_work_min_v($ptask_id)
set estimated_hours_max_arr($i) $estimated_hours_work_max_v($ptask_id)
- if {[exists_and_not_null dependency_v($ptask_id)]} {
- set use_dependency_arr($i) [list checked ""]
- } else {
- set use_dependency_arr($i) ""
- }
-
# keeps track of what process_task_id this was based on
# so we can later get info on what assignments the process
# task had, and what dependencies as well
@@ -344,17 +344,55 @@
}
}
+# get dependency types
+set options [list]
+db_foreach get_dependency_types { } -column_array dependencies {
+ lappend options "{\"$dependencies(description)\" $dependencies(short_name)}"
+}
+
+# get tasks this task can depend on
+
+set dependency_keys [list]
+
+db_foreach get_dependency_tasks { } -column_array dependency_tasks {
+
+ set dependency_options($dependency_tasks(task_title)) $dependency_tasks(item_id)
+ lappend dependency_keys $dependency_tasks(task_title)
+}
+
+set dependency_keys [lsort $dependency_keys]
+
+
+
+
# ----------------------------------------------
# extend the form with all the items that repeat
# ----------------------------------------------
for {set i 1} {$i <= $number} {incr i} {
-
+
+ # ----------------------------------------------------------------
# reading this code, you may wonder why we put the .$i at the end.
# DaveB showed me this trick. It lets you make a multiple out of
# the items by stuffing them in an array. Long live DaveB.
+ # ----------------------------------------------------------------
+ # set up the tasks that can be viewed. Take out the current task.
+ # TODO: add in process defaults
+ set dependency_options_full ""
+ append dependency_options_full "{\"--None--\" \"\"} "
+ # adds in the NEW tasks as options. We have to check later to make sure
+ # the user doesn't enter any loops!
+ for {set j 1} {$j <= $number} {incr j} {
+ if {![string equal $i $j]} {
+ append dependency_options_full "{\"New Task \#$j\" \"num$j\"} "
+ }
+ }
+ foreach key $dependency_keys {
+ append dependency_options_full "{\"$key\" $dependency_options($key)} "
+ }
+
ad_form -extend \
-name add_edit \
-form \
@@ -380,18 +418,24 @@
{value {$description_arr($i)}} \
] \
[list \
- use_dependency_p.$i:text(checkbox),optional \
- {label "Use dependency"} \
- {options {{"" "on"}}} \
- {html $use_dependency_arr($i)} \
- ] \
- [list \
end_date.$i:date,to_sql(linear_date),optional \
{label "Deadline"} \
{format "MONTH DD YYYY"} \
{value $end_date_arr($i)} \
{help} \
] \
+ [list \
+ dependency_type.$i:text(select),optional \
+ {label \"Dependency type\"} \
+ {options {[join $options " "]}} \
+ {value {finish_before_start}} \
+ ] \
+ [list \
+ dependency_task_id.$i:text(select),optional \
+ {label \"Dependency\"} \
+ {options {$dependency_options_full}} \
+ {help_text {$task_term the dependency is based on}} \
+ ] \
]
if {$use_uncertain_completion_times_p} {
@@ -439,12 +483,9 @@
# --------------------------------------------------------------
# each task we add in returns a task_revision_id
- # we set up two lists, one for tasks that will need dependencies
- # another for tasks that don't
# --------------------------------------------------------------
- set revision_has_dependencies [list]
- set revision_no_dependencies [list]
+ set task_id [list]
for {set i 1} {$i <= $number} {incr i} {
@@ -466,38 +507,112 @@
}
# set up variables, pulling from arrays
- set p_task_title $task_title($i)
- set p_description $description($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)
+ set p_task_title $task_title($i)
+ set p_description $description($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)
+ set p_dep_type $dependency_type($i)
+ set p_dep_id $dependency_task_id($i)
+ set parent_task_id $p_dep_id
- ns_log Notice "adding task: pii: $project_item_id tt:$p_task_title d:$p_description ed: end_date($i) w:$p_work m:$p_work_min mx:$p_work_max"
+ ns_log Notice "adding task: pii: $project_item_id tt:$p_task_title d:$p_description ed: end_date($i) w:$p_work m:$p_work_min mx:$p_work_max dep_type:$p_dep_type dep_id:$p_dep_id"
+ # add in the new task
set this_revision_id [db_exec_plsql new_task_item { *SQL* }]
+ set this_task_id [db_string get_task_item_id {}]
+ set dep_task_id($i) $this_task_id
- if {[info exists use_dependency_p($i)] && [string equal $use_dependency_p($i) "on"]} {
- lappend revision_has_dependencies $this_revision_id
- } else {
- lappend revision_no_dependencies $this_revision_id
+ if {[exists_and_not_null p_dep_id]} {
+
+ # if the p_dep_id contains num at the beginning, then
+ # the task is supposed to depend on other tasks that
+ # are currently being created. We have to do all sorts of
+ # things like make sure there are no loops, etc..
+ if {[regexp {num.*} $p_dep_id]} {
+ regexp {num(.*)} $p_dep_id match d_parent
+
+ # dep_parent tracks who is parent of what
+ set dep_parent($i) $d_parent
+ set dep_type($i) $p_dep_type
+ lappend parent_new_task $i
+ # we wait until after all the tasks have been created to create these
+ # dependencies
+ } else {
+
+ # add in the new dependency
+ set dependency_id [db_nextval pm_task_dependency_seq]
+ db_dml new_dependency { *SQL* }
+ }
}
lappend process_task_id $process_task_ids($i)
+ lappend revisions $this_revision_id
+ lappend task_id $this_task_id
}
+ if {[exists_and_not_null parent_new_task]} {
+ # there are tasks that depend on newly created tasks.
+ # 1. check for loops
+ # 2. if no loops, create dependencies
+
+ # the way we check for a loop is to follow the dependencies
+ # until we get to a task that has already been created.
+ # we make the assumption that the following is true:
+ # starting condition: no tasks are created
+ # when adding a task: no loop is created if you depend on a task already present
+ # therefore, if you add a task without creating a loop in the newly
+ # created tasks, you are safe.
+
+ # we check that the new items don't depend on each other by following them
+ # if they loop more than $number times, then we have a loop
+ set loop_limit $number
+
+ foreach dep_task $parent_new_task {
+
+ set passes_p f
+
+ set my_task $dep_task
+ while {$loop_limit >= 0} {
+
+ if {[exists_and_not_null dep_parent($my_task)]} {
+ set my_task $dep_parent($my_task)
+ } else {
+ set passes_p t
+ break
+ }
+
+ set loop_limit [expr $loop_limit - 1]
+ }
+
+ if {[string equal $passes_p t]} {
+ # add in the new dependency
+ set dependency_id [db_nextval pm_task_dependency_seq]
+ set this_task_id $dep_task_id($dep_task)
+ set parent_task_id $dep_task_id($dep_parent($dep_task))
+ set p_dep_type $dep_type($dep_task)
+ db_dml new_dependency { *SQL* }
+ } else {
+ ns_log Notice "PM: Adding in dependency failed for $dep_task_id($dep_task) due to looping"
+ }
+
+ }
+
+
+
+ }
+
+ ns_log Notice "Project_item_id $project_item_id"
+ project_manager::project::compute_parent_status $project_item_id
+
} -edit_data {
ns_log Notice "edit_data"
# --------------------------------------------------------------
# each task we edit returns a task_revision_id
- # we set up two lists, one for tasks that will need dependencies
- # another for tasks that don't
# --------------------------------------------------------------
- set revision_has_dependencies [list]
- set revision_no_dependencies [list]
-
for {set i 1} {$i <= $number} {incr i} {
if {![exists_and_not_null estimated_hours_work($i)]} {
@@ -531,14 +646,13 @@
ns_log Notice "Added in $this_revision_id"
+ lappend revisions $this_revision_id
+
+ ns_log Notice "in new: task_id $task_id"
+
# BUG: we need to make sure we take care of deleting dependencies
# if unchecked, adding dependencies, etc..
- if {[info exists use_dependency_p($i)] && [string equal $use_dependency_p($i) "t"]} {
- lappend revision_has_dependencies $this_revision_id
- } else {
- lappend revision_no_dependencies $this_revision_id
- }
}
project_manager::project::compute_parent_status $project_item_id
@@ -547,12 +661,9 @@
} -after_submit {
- # now go through the use_dependency_p items. For each that is checked,
- # we add that to a list of ids that we pass to the dependency-add-edit
- # page.
+ ns_log Notice "TASK_ID: $task_id"
-
- ad_returnredirect "task-assign-add-edit?[export_vars -url {revision_has_dependencies:multiple revision_no_dependencies:multiple project_item_id process_task_id:multiple}]"
+ ad_returnredirect "task-assign-add-edit?[export_vars -url {project_item_id process_task_id:multiple revisions:multiple task_id:multiple}]"
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.4 -r1.4.2.1
--- openacs-4/contrib/packages/project-manager/www/task-assign-add-edit-postgresql.xql 10 Oct 2003 22:51:04 -0000 1.4
+++ openacs-4/contrib/packages/project-manager/www/task-assign-add-edit-postgresql.xql 10 Jan 2004 01:04:02 -0000 1.4.2.1
@@ -1,22 +1,34 @@
-
+
select
+ title as one_line,
+ description,
item_id
FROM
pm_tasks_revisionsx t
WHERE
revision_id in ([join $revisions ","])
+ ORDER BY
+ item_id
-
+
select
title as one_line,
description,
- item_id
+ 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,
+ to_char(earliest_start, 'YYYY-MM-DD HH24:MI:SS') as earliest_start_ansi,
+ to_char(earliest_finish, 'YYYY-MM-DD HH24:MI:SS') as earliest_finish_ansi,
+ to_char(latest_start, 'YYYY-MM-DD HH24:MI:SS') as latest_start_ansi,
+ to_char(latest_finish, 'YYYY-MM-DD HH24:MI:SS') as latest_finish_ansi
FROM
pm_tasks_revisionsx t
WHERE
@@ -104,4 +116,15 @@
+
+
+ select
+ title
+ FROM
+ pm_projectsx
+ WHERE
+ item_id = :project_item_id
+
+
+
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.5.2.3 -r1.5.2.4
--- openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.tcl 13 Dec 2003 01:19:54 -0000 1.5.2.3
+++ openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.tcl 10 Jan 2004 01:04:02 -0000 1.5.2.4
@@ -28,9 +28,8 @@
my_key:integer,optional
{process_task_id:multiple,optional ""}
- revision_has_dependencies:multiple,optional
- revision_no_dependencies:multiple,optional
task_id:multiple,optional
+ revisions:multiple
{project_item_id:integer ""}
role_id:array,optional
party_id:array,optional
@@ -49,42 +48,14 @@
# --------------------------------------------------------------- #
-if {![exists_and_not_null revision_no_dependencies]} {
- set revision_no_dependencies ""
-}
-
-if {![exists_and_not_null revision_has_dependencies]} {
- set revision_has_dependencies ""
-}
-
-ns_log Notice "Before hack, revision_no_dependencies: $revision_no_dependencies revision_has_dependencies: $revision_has_dependencies"
-
-
# hack to get around lack of multiple hidden support with ad_form
-set process_task_id_pass [string map {"-" " "} $process_task_id]
-set process_task_id $process_task_id_pass
+set process_task_id [string map {"-" " "} $process_task_id]
+set revisions [string map {"-" " "} $revisions]
+set task_id [string map {"-" " "} $task_id]
-set task_revision_dep_pass $revision_has_dependencies
-set task_revision_dep_pass [string map {"-" " "} $task_revision_dep_pass]
-set revision_has_dependencies $task_revision_dep_pass
-
-set task_revision_nodep_pass $revision_no_dependencies
-set task_revision_nodep_pass [string map {"-" " "} $task_revision_nodep_pass]
-set revision_no_dependencies $task_revision_nodep_pass
-
-ns_log Notice " After hack, revision_no_dependencies: $revision_no_dependencies revision_has_dependencies: $revision_has_dependencies"
-
-
-set revisions [concat $revision_has_dependencies $revision_no_dependencies]
-
-set task_id [db_list get_task_item_ids { }]
-
-
-
db_multirow tasks get_task_info { }
-
# create a multirow we can use to iterate
template::multirow create num number
@@ -100,6 +71,7 @@
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 "0"]
# the unique identifier for this package
set package_id [ad_conn package_id]
@@ -119,27 +91,22 @@
set roles_lofl "{{--Select Role--} {}} "
append roles_lofl [db_list_of_lists get_roles { }]
-
set process_task_id_pass [string map {" " "-"} $process_task_id]
+set revisions_pass [string map {" " "-"} $revisions]
+set task_id_pass [string map {" " "-"} $task_id]
-set task_revision_dep_pass $revision_has_dependencies
-set task_revision_dep_pass [string map {" " "-"} $task_revision_dep_pass]
-
-set task_revision_nodep_pass $revision_no_dependencies
-set task_revision_nodep_pass [string map {" " "-"} $task_revision_nodep_pass]
-
ad_form -name add_edit -form {
my_key:key(acs_object_id_seq)
{process_task_id:text(hidden)
{value $process_task_id_pass}}
- {revision_has_dependencies:text(hidden)
- {value $task_revision_dep_pass}}
+ {revisions:text(hidden)
+ {value $revisions_pass}}
- {revision_no_dependencies:text(hidden)
- {value $task_revision_nodep_pass}}
+ {task_id:text(hidden)
+ {value $task_id_pass}}
{project_item_id:text(hidden)
{value $project_item_id}}
@@ -156,6 +123,24 @@
#role_id
#party_id
+ set process_task_id [string map {"-" " "} $process_task_id]
+ set revisions [string map {"-" " "} $revisions]
+ set task_id [string map {"-" " "} $task_id]
+
+ 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
+ set earliest_starts($item_id) [lc_time_fmt $earliest_start_ansi "%x"]
+ set earliest_finishes($item_id) [lc_time_fmt $earliest_finish_ansi "%x"]
+ set latest_starts($item_id) [lc_time_fmt $latest_start_ansi "%x"]
+ set latest_finishes($item_id) [lc_time_fmt $latest_finish_ansi "%x"]
+
+ }
+
if {[info exists role_id]} {
set searchToken [array startsearch role_id]
@@ -210,6 +195,15 @@
db_dml delete_assignments { }
+ set project_name [db_string get_project_name { } -default "N/A"]
+
+ # set up role names
+ foreach r [db_list_of_lists get_roles { }] {
+ set des [lindex $r 0]
+ set val [lindex $r 1]
+ set role_oneline($val) $des
+ }
+
foreach pl $party_list {
regexp {(.*),(.*)} $pl match task_id_v num_value
@@ -220,6 +214,57 @@
ns_log Notice "tid: $t_id rid: $r_id pid: $p_id"
+ set subject "New Task \#$t_id: $one_lines($t_id)"
+
+ if {[string equal $use_uncertain_completion_times_p 1]} {
+ set estimated_work "
+Hrs work (min): $est_hours_work_min($t_id)
+Hrs work (max): $est_hours_work_max($t_id)"
+ } else {
+ set estimated_work "
+Hrs work: $est_hours_work($t_id)"
+
+}
+ set notification_text "-------------
+Task overview
+-------------
+Task ID: \#$t_id
+Description: $one_lines($t_id)
+Project: $project_name
+Your role: $role_oneline($r_id)
+
+---------------
+Estimated work:
+---------------$estimated_work
+
+------
+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)
+Latest finish $latest_finishes($item_id)
+
+-----------
+Description
+-----------
+$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 $user_id \
+ -notif_subject $subject \
+ -notif_text $notification_text
+
db_dml add_assignment { }
}
@@ -301,15 +346,7 @@
} -after_submit {
- # for some reason this hack is necessary here
-
- set task_revision_dep_pass $revision_has_dependencies
- set task_revision_dep_pass [string map {"-" " "} $task_revision_dep_pass]
- set revision_has_dependencies $task_revision_dep_pass
-
- set task_revisions $revision_has_dependencies
-
- ad_returnredirect "dependency-add-edit?[export_vars -url {task_revisions:multiple project_item_id process_task_id:multiple}]"
+ ad_returnredirect "one?project_item_id=$project_item_id"
ad_script_abort
}
@@ -343,7 +380,7 @@
set users_length [string length $users_values]
set roles_length [string length $roles_values]
- for {set i 0} {$i <= 10} {incr i} {
+ for {set i 0} {$i <= 5} {incr i} {
if {$i < $users_length && $i < $roles_length} {
set uv [lindex $users_values $i]
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.16 -r1.16.2.1
--- openacs-4/contrib/packages/project-manager/www/task-one-postgresql.xql 3 Oct 2003 22:21:45 -0000 1.16
+++ openacs-4/contrib/packages/project-manager/www/task-one-postgresql.xql 10 Jan 2004 01:04:02 -0000 1.16.2.1
@@ -43,10 +43,12 @@
t.description,
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,
to_char(t.earliest_finish,'Mon DD ''YY') as earliest_finish,
to_char(t.latest_start,'Mon DD ''YY') as latest_start,
+ to_char(t.latest_start,'J') as latest_start_j,
to_char(t.latest_finish,'Mon DD ''YY') as latest_finish,
- to_char(t.latest_start-t.earliest_start,'DD') || ' days' as slack_time,
+ to_char(current_date,'J') as today_j,
t.estimated_hours_work,
t.estimated_hours_work_min,
t.estimated_hours_work_max,
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.19.2.1 -r1.19.2.2
--- openacs-4/contrib/packages/project-manager/www/task-one.adp 4 Dec 2003 21:00:13 -0000 1.19.2.1
+++ openacs-4/contrib/packages/project-manager/www/task-one.adp 10 Jan 2004 01:04:02 -0000 1.19.2.2
@@ -12,7 +12,9 @@
- |
+
+
+ |
@task_term@ #@item_id@: @task_info.task_title@ |
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.22.2.3 -r1.22.2.4
--- openacs-4/contrib/packages/project-manager/www/task-one.tcl 13 Dec 2003 01:19:54 -0000 1.22.2.3
+++ openacs-4/contrib/packages/project-manager/www/task-one.tcl 10 Jan 2004 01:04:02 -0000 1.22.2.4
@@ -92,6 +92,16 @@
db_1row task_query { } -column_array task_info
set task_info(description) [ad_text_to_html -- $task_info(description)]
+if {[exists_and_not_null task_info(earliest_start_j)]} {
+ if {$task_info(earliest_start_j) < $task_info(today_j)} {
+ set task_info(slack_time) "[expr $task_info(latest_start_j) - $task_info(today_j)] days"
+ } else {
+ set task_info(slack_time) "[expr $task_info(latest_start_j) - $task_info(earliest_start_j)] days"
+ }
+} else {
+ set task_info(slack_time) "n/a"
+}
+
# Task Revisions, using list-builder ---------------------------------
template::list::create \
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.1.2.1 -r1.1.2.2
--- openacs-4/contrib/packages/project-manager/www/tasks-postgresql.xql 4 Dec 2003 21:00:13 -0000 1.1.2.1
+++ openacs-4/contrib/packages/project-manager/www/tasks-postgresql.xql 10 Jan 2004 01:04:02 -0000 1.1.2.2
@@ -23,11 +23,10 @@
p.first_names || ' ' || p.last_name as full_name,
r.one_line as role
FROM
- pm_tasks ts, pm_tasks_revisionsx t LEFT JOIN pm_task_assignment ta on t.item_id = ta.task_id, persons p, pm_roles r
+ pm_tasks ts, (select * from pm_tasks_revisionsx t LEFT JOIN pm_task_assignment ta on t.item_id = ta.task_id) t LEFT JOIN persons p ON t.party_id = p.person_id, pm_roles r
WHERE
ts.task_id = t.item_id and
- ta.party_id = p.person_id and
- ta.role_id = r.role_id
+ t.role_id = r.role_id
[template::list::filter_where_clauses -and -name tasks]
[template::list::orderby_clause -orderby -name tasks]
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.1.2.3 -r1.1.2.4
--- openacs-4/contrib/packages/project-manager/www/tasks.tcl 13 Dec 2003 01:19:54 -0000 1.1.2.3
+++ openacs-4/contrib/packages/project-manager/www/tasks.tcl 10 Jan 2004 01:04:02 -0000 1.1.2.4
@@ -101,7 +101,7 @@
label "People"
values {[db_list_of_lists get_people "select first_names || ' ' || last_name, u.party_id from all_users u, pm_task_assignment a where u.party_id = a.party_id order by upper(first_names), upper(last_name)"]}
where_clause {
- ta.party_id = :party_id
+ t.party_id = :party_id
}
}
} \