Index: openacs-4/contrib/packages/project-manager/www/dependency-add-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/dependency-add-edit.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/contrib/packages/project-manager/www/dependency-add-edit.tcl 12 Sep 2003 21:36:32 -0000 1.3
+++ openacs-4/contrib/packages/project-manager/www/dependency-add-edit.tcl 17 Sep 2003 22:20:59 -0000 1.4
@@ -47,6 +47,7 @@
}
if {![exists_and_not_null task_revisions]} {
+ project_manager::project::compute_parent_status $project_item_id
ad_returnredirect "one?[export_url_vars project_item_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.16 -r1.17
--- openacs-4/contrib/packages/project-manager/www/one-postgresql.xql 12 Sep 2003 21:36:32 -0000 1.16
+++ openacs-4/contrib/packages/project-manager/www/one-postgresql.xql 17 Sep 2003 22:20:59 -0000 1.17
@@ -82,7 +82,7 @@
SELECT
- t.item_id,
+ t.item_id as task_id,
t.title,
to_char(t.end_date,'Mon DD ''YY') as end_date,
to_char(t.earliest_start,'Mon DD ''YY') as earliest_start,
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.20 -r1.21
--- openacs-4/contrib/packages/project-manager/www/one.tcl 12 Sep 2003 22:54:07 -0000 1.20
+++ openacs-4/contrib/packages/project-manager/www/one.tcl 17 Sep 2003 22:20:59 -0000 1.21
@@ -96,7 +96,7 @@
template::list::create \
-name tasks \
-multirow tasks \
- -key item_id \
+ -key task_id \
-elements {
title {
label "Subject"
@@ -152,18 +152,21 @@
label "Who"
html {valign top}
display_template {
- @tasks.first_names@ @tasks.last_name@
+ @tasks.first_names@ @tasks.last_name@
}
}
} \
-actions {
"Use process" "process-use" "Use a process"
- "Task calendar" "\#" "View task calendar"
} \
-bulk_actions {
"Edit" "task-add-edit" "Edit tasks"
} \
+ -bulk_action_export_vars {
+ project_item_id
+ project_id
+ } \
-main_class {
narrow
} \
@@ -190,7 +193,7 @@
db_multirow -extend { item_url } tasks project_tasks_query {
} {
- set item_url [export_vars -base "task-one" -override {{task_id $item_id}} { revision_id task_id}]
+ set item_url [export_vars -base "task-one" { revision_id task_id}]
}
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.8 -r1.9
--- openacs-4/contrib/packages/project-manager/www/task-add-edit-postgresql.xql 29 Aug 2003 00:35:35 -0000 1.8
+++ openacs-4/contrib/packages/project-manager/www/task-add-edit-postgresql.xql 17 Sep 2003 22:20:59 -0000 1.9
@@ -12,33 +12,78 @@
'$estimated_hours_work($i)',
'$estimated_hours_work_min($i)',
'$estimated_hours_work_max($i)',
- now(),
+ current_timestamp,
:user_id,
:peeraddr,
:package_id
);
+
+
+ select pm_task__new_task_revision (
+ '$task_item_id($i)',
+ :project_item_id,
+ '$task_title($i)',
+ '$description($i)',
+ [project_manager::project::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'),"]
+ '$percent_complete($i)',
+ '$estimated_hours_work($i)',
+ '$estimated_hours_work_min($i)',
+ '$estimated_hours_work_max($i)',
+ '$actual_hours_worked($i)',
+ current_timestamp,
+ :user_id,
+ :peeraddr,
+ :package_id
+ );
+
+
+
select
+ current_timestamp
+ FROM
+ dual
+
+
+
+
+
+ select
t.task_revision_id,
t.title as task_title,
t.item_id,
t.description,
t.name,
- t.parent_id,
to_char(t.end_date,'YYYY MM DD') as end_date,
t.percent_complete,
t.estimated_hours_work,
t.estimated_hours_work_min,
- t.estimated_hours_work_max
- FROM
- pm_tasks_revisionsx t, cr_items i
+ t.estimated_hours_work_max,
+ d.parent_task_id,
+ t.actual_hours_worked
+ FROM
+ pm_tasks_revisionsx t,
+ cr_items i LEFT JOIN pm_task_dependency d ON i.item_id = d.task_id
WHERE
- t.item_id = :task_id and
+ t.item_id in ([join $task_id ","]) and
t.revision_id = i.live_revision
+
+
+
+ SELECT
+ p.project_id
+ FROM
+ pm_projectsx p, cr_items i
+ WHERE
+ p.item_id = :project_item_id and
+ p.revision_id = i.live_revision
+
+
+
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.8 -r1.9
--- openacs-4/contrib/packages/project-manager/www/task-add-edit.adp 29 Aug 2003 00:35:35 -0000 1.8
+++ openacs-4/contrib/packages/project-manager/www/task-add-edit.adp 17 Sep 2003 22:20:59 -0000 1.9
@@ -51,7 +51,6 @@
-
+
+
+
+
+ Percent complete: |
+ |
+
+
+ Hours worked: |
+ |
+
+
+
+
+
+
+
+
+
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.16 -r1.17
--- openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 12 Sep 2003 01:20:57 -0000 1.16
+++ openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 17 Sep 2003 22:20:59 -0000 1.17
@@ -9,6 +9,7 @@
@return context_bar Context bar.
@return title Page title.
@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 project_item_id Specifies which project this task is associated with
@param project_id Specifies which project revision this task is associated with
@@ -26,13 +27,14 @@
{number:integer "1"}
task_revision_id:integer,optional
task_id:multiple,integer,optional
+ task_item_id:array,optional
task_title:array,optional
use_dependency_p:array,optional
description:array,optional
name:array,optional
- parent_id:array,optional
end_date:array,optional
percent_complete:array,optional
+ actual_hours_worked:array,optional
estimated_hours_work:array,optional
estimated_hours_work_min:array,optional
estimated_hours_work_max:array,optional
@@ -43,6 +45,7 @@
title:onevalue
num:multirow
use_uncertain_completion_times_p:onevalue
+ edit_p:onevalue
} -validate {
number_is_in_range -requires {number:integer} {
@@ -63,14 +66,48 @@
# --------------------------------------------------------------- #
-# create a multirow we can use to iterate
-template::multirow create num number
+if {![exists_and_not_null project_id]} {
+ set project_id [db_string get_project_id { }]
+}
-for {set i 1} {$i <= $number} {incr i} {
- template::multirow append num $i
+ns_log notice it's my page!
+set mypage [ns_getform]
+if {[string equal "" $mypage]} {
+ ns_log notice no form was submitted on my page
+} else {
+ ns_log notice the following form was submitted on my page
+ ns_set print $mypage
}
+if {[info exists task_id] && ![info exists __new_p]} {
+ # create a multirow we can use to iterate
+ # we also set the number variable so we can use that in
+ # this tcl file
+ template::multirow create num number
+
+ set i 1
+ set number 0
+ foreach tid $task_id {
+ template::multirow append num $i
+ incr i
+ incr number
+ }
+ set edit_p t
+
+} else {
+ # create a multirow we can use to iterate
+ template::multirow create num number
+
+ for {set i 1} {$i <= $number} {incr i} {
+ template::multirow append num $i
+ }
+
+ set edit_p f
+}
+
+
+
# The evilest hack of all time.
# -------------------------------------------------------
# This is a workaround the fact that using multiple dates
@@ -120,7 +157,7 @@
set package_id [ad_conn package_id]
set user_id [ad_maybe_redirect_for_registration]
-# permissions
+# permissions and more
if {[exists_and_not_null task_id]} {
set title "Edit a $task_term_lower"
@@ -155,9 +192,11 @@
} -new_data {
+ # --------------------------------------------------------------
# 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]
@@ -187,6 +226,43 @@
} -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)]} {
+ set estimated_hours_work($i) [expr .5 * ($estimated_hours_work_max($i) - $estimated_hours_work_min($i)) + $estimated_hours_work_min($i)]
+ }
+
+ if {![exists_and_not_null estimated_hours_work_min($i)]} {
+ set estimated_hours_work_min($i) $estimated_hours_work($i)
+ }
+
+ if {![exists_and_not_null estimated_hours_work_max($i)]} {
+ set estimated_hours_work_max($i) $estimated_hours_work($i)
+ }
+
+ # do the actual edit
+ set this_revision_id [db_exec_plsql new_task_revision { }]
+ # set this_revision_id [db_exec_plsql new_task_item { *SQL* }]
+
+ # 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
+ }
+ }
+
} -select_query_name task_query -after_submit {
# now go through the use_dependency_p items. For each that is checked,
@@ -198,62 +274,173 @@
}
+# ----------------------------------
+# we set the values for edited tasks
+# ----------------------------------
+
+if {[info exists task_id]} {
+
+ set i 1
+
+ db_foreach get_old_tasks { } {
+
+ set task_title_arr($i) $task_title
+ set description_arr($i) $description
+ set estimated_hours_arr($i) $estimated_hours_work
+ set estimated_hours_min_arr($i) $estimated_hours_work_min
+ set estimated_hours_max_arr($i) $estimated_hours_work_max
+ set end_date_arr($i) $end_date
+ set percent_complete_arr($i) $percent_complete
+ 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) ""
+ }
+
+
+ # -----------------------------------------------------
+ # if we are editing the tasks, then we want to show the
+ # percent_complete
+ # -----------------------------------------------------
+
+ ad_form -extend \
+ -name add_edit \
+ -select_query_name task_query \
+ -form \
+ [list [list percent_complete.$i:text \
+ {label "Percent complete"} \
+ {html {size 4}} \
+ {value {$percent_complete_arr($i)}} \
+ ] \
+ [list actual_hours_worked.$i:text \
+ {label "Hours worked"} \
+ {html {size 4}} \
+ {value {$actual_hours_worked_arr($i)}} \
+ ]
+ ]
+
+ incr i
+ }
+} else {
+
+ for {set i 1} {$i <= $number} {incr i} {
+ set task_title_arr($i) ""
+ set description_arr($i) ""
+ set estimated_hours_arr($i) ""
+ set estimated_hours_min_arr($i) ""
+ set estimated_hours_max_arr($i) ""
+ set use_dependency_arr($i) ""
+ set parent_arr($i) ""
+ set end_date_arr($i) ""
+ set percent_complete_arr($i) 0
+ set actual_hours_worked_arr($i) 0
+ set task_item_id_arr($i) ""
+
+ # -----------------------------------------------------
+ # for new tasks, we hide the percent_complete
+ # -----------------------------------------------------
+
+ ad_form -extend \
+ -name add_edit \
+ -select_query_name task_query \
+ -form \
+ [list [list percent_complete.$i:text(hidden) \
+ {label "Percent complete \#$i"} \
+ {html {size 4}} \
+ {value {$percent_complete_arr($i)}} \
+ ] \
+ [list actual_hours_worked.$i:text(hidden) \
+ {label "Hours worked"} \
+ {html {size 4}} \
+ {value {$actual_hours_worked_arr($i)}} \
+ ]
+ ]
+
+ }
+}
+
+
+# ----------------------------------------------
+# 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.
- ad_form -extend -name add_edit -form \
+ ad_form -extend \
+ -name add_edit \
+ -select_query_name task_query \
+ -form \
[list \
[list \
task_title.$i:text \
{label "Subject \#$i"} \
{html {size 39}} \
+ {value {$task_title_arr($i)}}
] \
+ [list task_item_id.$i:text(hidden) \
+ {label "Task item id"} \
+ {html {size 4}} \
+ {value {$task_item_id_arr($i)}} \
+ ] \
[list \
description.$i:text(textarea),optional \
{label "Description"} \
{html {rows 7 cols 40}} \
+ {value {$description_arr($i)}} \
] \
[list \
use_dependency_p.$i:text(checkbox) \
{label "Use dependency"} \
- {value "t"} \
+ {options {{"" "t"}}} \
+ {html $use_dependency_arr($i)} \
] \
[list \
- parent_id.$i:text(hidden) \
- ] \
- [list \
end_date.$i:date,to_sql(linear_date),optional \
{label "Deadline"} \
{format "MONTH DD YYYY"} \
+ {value $end_date_arr($i)} \
{help} \
] \
]
if {$use_uncertain_completion_times_p} {
- ad_form -extend -name add_edit -form \
+ ad_form -extend \
+ -name add_edit \
+ -select_query_name task_query \
+ -form \
[list \
[list \
estimated_hours_work_min.$i:integer \
{label "Hours estimate - min"} \
{html {size 3}} \
+ {value {$estimated_hours_min_arr($i)}} \
] \
[list \
estimated_hours_work_max.$i:integer \
{label "Hours estimate - max"} \
{html {size 3}} \
+ {value {$estimated_hours_max_arr($i)}} \
] \
]
} else {
- ad_form -extend -name add_edit -form \
+ ad_form -extend -name add_edit \
+ -select_query_name task_query \
+ -form \
[list \
[list \
estimated_hours_work.$i:integer \
{label "Hours estimate"} \
{html {size 3}} \
+ {value {$estimated_hours_arr($i)}} \
] \
]
}
}
+
Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/www/task-edit-postgresql.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/www/task-edit.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.7 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/www/task-edit.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
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.14 -r1.15
--- openacs-4/contrib/packages/project-manager/www/task-one.adp 12 Sep 2003 21:36:32 -0000 1.14
+++ openacs-4/contrib/packages/project-manager/www/task-one.adp 17 Sep 2003 22:20:59 -0000 1.15
@@ -12,7 +12,7 @@
- |
+ |
@task_term@ #@item_id@: @task_info.task_title@ |