Index: openacs-4/contrib/packages/project-manager/www/process-one.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-one.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/contrib/packages/project-manager/www/process-one.tcl 7 Oct 2003 00:15:09 -0000 1.3
+++ openacs-4/contrib/packages/project-manager/www/process-one.tcl 8 Oct 2003 20:16:11 -0000 1.4
@@ -44,7 +44,7 @@
-elements {
one_line {
label "Subject"
- display_template {@tasks.one_line@}
+ display_template {@tasks.one_line@}
}
description {
label "Description"
Index: openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-add-edit-2-postgresql.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2-postgresql.xql 3 Oct 2003 22:21:45 -0000 1.1
+++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2-postgresql.xql 8 Oct 2003 20:16:11 -0000 1.2
@@ -22,4 +22,24 @@
+
+
+ update pm_process_task set
+ one_line = :one_line,
+ description = :desc,
+ estimated_hours_work = :work,
+ estimated_hours_work_min = :work_min,
+ estimated_hours_work_max = :work_max
+ where
+ process_task_id = :task_id
+
+
+
+
+
+ select count(*) from pm_process_task where
+ process_task_id in ([join $process_task_id ","])
+
+
+
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.2 -r1.3
--- openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl 3 Oct 2003 23:13:15 -0000 1.2
+++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl 8 Oct 2003 20:16:11 -0000 1.3
@@ -85,29 +85,77 @@
set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"]
-set index 0
-foreach ptid $process_task_id {
+# ------------------------------------------------------------
+# we need to determine if these tasks are new or being edited.
+# we know this by checking if the numbers exist.
+# we assume that if any of them exist, that we're editing.
+# ------------------------------------------------------------
- # set up the values
- set task_id [lindex $process_task_id $index]
+set edit_p [db_string editing_process_tasks_p { } -default "0"]
- set one_line [lindex $task_title $index]
- set desc [lindex $description $index]
- if {[string equal $use_uncertain_completion_times_p "1"]} {
- set work_min [lindex $estimated_hours_work_min $index]
- set work_max [lindex $estimated_hours_work_max $index]
- set work [expr .5 * [expr $work_max - $work_min] + $work_min]
- } else {
- set work [lindex $estimated_hours_work $index]
- set work_min $work
- set work_max $work
+ns_log Notice "edit_p: $edit_p"
+
+if {[string equal $edit_p "0"]} {
+
+ # -----------------------------
+ # if we're adding process tasks
+ # -----------------------------
+
+ set index 0
+ foreach ptid $process_task_id {
+
+ # set up the values
+ set task_id [lindex $process_task_id $index]
+
+ set one_line [lindex $task_title $index]
+ set desc [lindex $description $index]
+
+ if {[string equal $use_uncertain_completion_times_p "1"]} {
+ set work_min [lindex $estimated_hours_work_min $index]
+ set work_max [lindex $estimated_hours_work_max $index]
+ set work [expr .5 * [expr $work_max - $work_min] + $work_min]
+ } else {
+ set work [lindex $estimated_hours_work $index]
+ set work_min $work
+ set work_max $work
+ }
+
+ db_dml new_task { *SQL* }
}
+} else {
- db_dml new_task { *SQL* }
-}
+ # -----------------------------
+ # if we're editing process tasks
+ # -----------------------------
+ # -----------------------------
+ # if we're adding process tasks
+ # -----------------------------
+ set index 0
+ foreach ptid $process_task_id {
+
+ # set up the values
+ set task_id [lindex $process_task_id $index]
+
+ set one_line [lindex $task_title $index]
+ set desc [lindex $description $index]
+
+ if {[string equal $use_uncertain_completion_times_p "1"]} {
+ set work_min [lindex $estimated_hours_work_min $index]
+ set work_max [lindex $estimated_hours_work_max $index]
+ set work [expr .5 * [expr $work_max - $work_min] + $work_min]
+ } else {
+ set work [lindex $estimated_hours_work $index]
+ set work_min $work
+ set work_max $work
+ }
+
+ db_dml edit_task { *SQL* }
+ }
+}
+
if {1 == 0} {
set revision_has_dependencies [list]
Index: openacs-4/contrib/packages/project-manager/www/process-task-add-edit-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-add-edit-postgresql.xql,v
diff -u -r1.3 -r1.4
--- openacs-4/contrib/packages/project-manager/www/process-task-add-edit-postgresql.xql 7 Oct 2003 00:15:09 -0000 1.3
+++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit-postgresql.xql 8 Oct 2003 20:16:11 -0000 1.4
@@ -4,7 +4,7 @@
SELECT
- process_task_id,
+ process_task_id as pti,
one_line,
description,
estimated_hours_work,
Index: openacs-4/contrib/packages/project-manager/www/process-task-add-edit.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-add-edit.adp,v
diff -u -r1.4 -r1.5
--- openacs-4/contrib/packages/project-manager/www/process-task-add-edit.adp 7 Oct 2003 00:15:09 -0000 1.4
+++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit.adp 8 Oct 2003 20:16:11 -0000 1.5
@@ -18,9 +18,9 @@
@num.rownum@ |
-Subject:*
+ | Subject:*
- Description:
|
+ Description:
@@ -32,14 +32,14 @@
Min: |
- hrs |
+ hrs |
Max: |
- hrs |
+ hrs |
- hrs |
+ hrs |
Index: openacs-4/contrib/packages/project-manager/www/process-task-add-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-add-edit.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/contrib/packages/project-manager/www/process-task-add-edit.tcl 7 Oct 2003 00:15:09 -0000 1.4
+++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit.tcl 8 Oct 2003 20:16:11 -0000 1.5
@@ -34,6 +34,7 @@
} -properties {
context_bar:onevalue
+ onevalue:multirow
title:onevalue
process_id:onevalue
num:multirow
@@ -67,44 +68,72 @@
set package_id [ad_conn package_id]
set user_id [ad_maybe_redirect_for_registration]
-# --------------------
-# permissions and more
-# --------------------
+# -----------
+# permissions
+# -----------
+permission::require_permission -party_id $user_id -object_id $package_id -privilege read
-set title "Add a process $task_term_lower"
-set context_bar [ad_context_bar [list "process-one?process_id=$process_id" "One"] "Add tasks"]
-permission::require_permission -party_id $user_id -object_id $package_id -privilege create
-
# ------------------------------------------------------------
# if process_task_id is set, then we are editing process tasks
# ------------------------------------------------------------
-if {[info exists process_task_id]} {
+if {[exists_and_not_null process_task_id]} {
+
+
+ set edit_p 1
+ set title "Edit a process $task_term_lower"
+ set context_bar [ad_context_bar [list "process-one?process_id=$process_id" "One"] "Edit tasks"]
+ permission::require_permission -party_id $user_id -object_id $package_id -privilege write
+
set process_tasks [list]
set i 1
db_foreach get_process_tasks { } {
- set process_task_v($i) $process_task_id
- set one_line.$i $one_line
+ set process_task_v($i) $pti
+ set one_line_v($i) $one_line
set description_v($i) $description
set estimated_hours_work_v($i) $estimated_hours_work
set estimated_hours_work_min_v($i) $estimated_hours_work_min
set estimated_hours_work_max_v($i) $estimated_hours_work_max
- lappend process_tasks $process_task_id
+ lappend process_tasks $pti
incr i
}
set number [llength $process_tasks]
+} else {
+
+ set edit_p 0
+ set title "Add a process $task_term_lower"
+ set context_bar [ad_context_bar [list "process-one?process_id=$process_id" "One"] "Add tasks"]
+ permission::require_permission -party_id $user_id -object_id $package_id -privilege create
+
+ for {set i 1} {$i <= $number} {incr i} {
+ set process_task_v($i) ""
+ set one_line_v($i) ""
+ set description_v($i) ""
+ set estimated_hours_work_v($i) ""
+ set estimated_hours_work_min_v($i) ""
+ set estimated_hours_work_max_v($i) ""
+ }
}
-template::multirow create num process_task_id
+template::multirow create num process_task_id one_line description work work_min work_max
+
for {set i 1} {$i <= $number} {incr i} {
- set process_task_id_tmp [db_nextval pm_process_task_seq]
- template::multirow append num $process_task_id_tmp
+ if {[string equal $edit_p "0"]} {
+ set process_task_id_tmp [db_nextval pm_process_task_seq]
+ } else {
+ set process_task_id_tmp [lindex $process_task_id [expr $i-1]]
+ }
+
+ ns_log Notice "process_task_id_tmp $process_task_id_tmp ($process_task_id)"
+
+ template::multirow append num $process_task_id_tmp $one_line_v($i) $description_v($i) $estimated_hours_work_v($i) $estimated_hours_work_min_v($i) $estimated_hours_work_max_v($i)
+
}
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.3 -r1.4
--- openacs-4/contrib/packages/project-manager/www/process-task-assign-add-edit.tcl 6 Oct 2003 22:57:28 -0000 1.3
+++ openacs-4/contrib/packages/project-manager/www/process-task-assign-add-edit.tcl 8 Oct 2003 20:16:11 -0000 1.4
@@ -188,6 +188,11 @@
}
+ set process_task_id_pass $process_task_id
+ set process_task_id_pass [string map {"-" " "} $process_task_id_pass]
+ set process_task_id $process_task_id_pass
+
+ ns_log Notice "deleting assignments process_task_id: $process_task_id"
db_dml delete_assignments { }
foreach pl $party_list {
@@ -198,7 +203,7 @@
set r_id $assignment_role($pl)
set p_id $assignment_party($pl)
- ns_log Notice "tid: $t_id rid: $r_id pid: $p_id"
+ ns_log Notice "add tid: $t_id rid: $r_id pid: $p_id"
db_dml add_assignment { }
@@ -262,6 +267,10 @@
}
+ set process_task_id_pass $process_task_id
+ set process_task_id_pass [string map {"-" " "} $process_task_id_pass]
+ set process_task_id $process_task_id_pass
+
db_dml delete_assignments { }
foreach pl $party_list {
@@ -272,7 +281,7 @@
set r_id $assignment_role($pl)
set p_id $assignment_party($pl)
- ns_log Notice "tid: $t_id rid: $r_id pid: $p_id"
+ ns_log Notice "edit tid: $t_id rid: $r_id pid: $p_id"
db_dml add_assignment { }
@@ -282,10 +291,11 @@
# 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 process_task_id_pass $process_task_id
+ set process_task_id_pass [string map {"-" " "} $process_task_id_pass]
+ set process_task_id $process_task_id_pass
+
#set task_revisions $revision_has_dependencies
ad_returnredirect "process-dependency-add-edit?[export_vars -url {process_task_id:multiple process_id use_dependency:multiple}]"