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.26 -r1.27 --- openacs-4/contrib/packages/project-manager/project-manager.info 21 Jun 2004 22:20:43 -0000 1.26 +++ openacs-4/contrib/packages/project-manager/project-manager.info 25 Jun 2004 00:04:42 -0000 1.27 @@ -7,14 +7,14 @@ f f - + Jade Rubick Project management tool for OpenACS - 2004-06-21 + 2004-06-24 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. - + @@ -24,8 +24,8 @@ - + 1} { + db_dml delete_dependency " + DELETE FROM pm_process_task_dependency + WHERE process_task_id in ([join $process_task_id ", "]) + " + } else { + db_dml delete_dependency { + DELETE FROM pm_process_task_dependency + WHERE process_task_id = :process_task_id + } + } + + return +} + + +ad_proc -public pm::process::add_dependency { + {-process_task_id:required} + {-parent_task_id:required} + {-dependency_type_id:required} +} { + Adds a dependency on parent_task_id for process_task_id + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-24 + + @param process_task_id + + @param parent_task_id + + @param dependency_type_id + + @return + + @error +} { + set dependency_id [db_nextval pm_task_dependency_seq] + + db_dml add_dependency { + INSERT INTO pm_process_task_dependency + (dependency_id, process_task_id, parent_task_id, dependency_type) + VALUES + (:dependency_id, :process_task_id, :parent_task_id, :dependency_type_id) + } + + return +} Index: openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-dependency-add-edit-postgresql.xql,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit-postgresql.xql 10 Oct 2003 22:51:04 -0000 1.3 +++ openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit-postgresql.xql 25 Jun 2004 00:04:42 -0000 1.4 @@ -10,7 +10,9 @@ FROM pm_process_task t LEFT JOIN pm_process_task_dependency d ON t.process_task_id = d.process_task_id WHERE - t.process_task_id in ([join $use_dependency ", "]) + t.process_task_id in ([join $use_dependency_list ", "]) + ORDER BY + t.ordering, t.process_task_id @@ -36,24 +38,8 @@ WHERE process_id = :process_id ORDER BY - upper(one_line) + ordering - - - DELETE FROM pm_process_task_dependency - WHERE process_task_id = :tsk_id - - - - - - INSERT INTO pm_process_task_dependency - (dependency_id, process_task_id, parent_task_id, dependency_type) - VALUES - (:dependency_id, :tsk_id, :parent_tsk_id, :type_id) - - - Index: openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-dependency-add-edit.adp,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.adp 10 Nov 2003 19:34:54 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.adp 25 Jun 2004 00:04:42 -0000 1.3 @@ -3,13 +3,15 @@ @title@ -You may now add dependencies to these +You may now add dependencies to these process @task_term_lower@s. Dependencies describe the order in which items must be completed. For example, "the boards must be delivered before construction can begin". Entering dependencies is important because it allows the system to automatically compute schedules. However, you can -skip adding dependencies. +skip adding dependencies. +

+

Index: openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-dependency-add-edit.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.tcl 3 Jun 2004 21:32:13 -0000 1.9 +++ openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.tcl 25 Jun 2004 00:04:42 -0000 1.10 @@ -15,7 +15,8 @@ } { - {use_dependency:multiple ""} + {use_dependency:array ""} + {use_dependency_list:multiple ""} process_id:integer dependency_id:integer,optional process_task_id:multiple,optional @@ -34,7 +35,13 @@ # --------------------------------------------------------------- # +# turn the use_dependency +if {[llength [array get use_dependency]] > 0} { + foreach {index value} [array get use_dependency] { + lappend use_dependency_list $value + } +} # HACK because there isn't a facility for exporting multiple hidden # form variables in ad_form @@ -43,12 +50,15 @@ set process_task_id_pass [string map {"-" " "} $process_task_id_pass] set process_task_id $process_task_id_pass -set use_dependency_pass $use_dependency -set use_dependency_pass [string map {"-" " "} $use_dependency_pass] -set use_dependency $use_dependency_pass +set use_dependency_list_pass $use_dependency_list +set use_dependency_list_pass [string map {"-" " "} $use_dependency_list_pass] +set use_dependency_list $use_dependency_list_pass -if {![exists_and_not_null use_dependency]} { +if {![exists_and_not_null use_dependency_list]} { + pm::process:remove_dependency \ + -process_task_id $process_task_id + ad_returnredirect "process-one?[export_url_vars process_id]" ad_script_abort } @@ -69,7 +79,7 @@ permission::require_permission -party_id $user_id -object_id $package_id -privilege create set process_task_id_pass [string map {" " "-"} $process_task_id] -set use_dependency_pass [string map {" " "-"} $use_dependency] +set use_dependency_list_pass [string map {" " "-"} $use_dependency_list] ad_form -name add_edit -form { dependency_id:key(pm_process_task_dependency_seq) @@ -78,8 +88,8 @@ {value $process_task_id_pass} } - {use_dependency:text(hidden) - {value $use_dependency_pass} + {use_dependency_list:text(hidden) + {value $use_dependency_list_pass} } {process_id:text(hidden) @@ -99,22 +109,24 @@ # convert from our hack back to a list set process_task_id [string map {"-" " "} $process_task_id] - foreach tsk_id $process_task_id { - db_dml delete_dependency { } - } + pm::process::remove_dependency \ + -process_task_id $process_task_id # convert from our hack back to a list - set use_dependency [string map {"-" " "} $use_dependency] + set use_dependency_list [string map {"-" " "} $use_dependency_list] - foreach tr $use_dependency { + foreach tr $use_dependency_list { set type_id $dependency_type($tr) set parent_tsk_id $dependency_task_id($tr) - set dependency_id [db_nextval pm_task_dependency_seq] + set tsk_revision_id $tr set tsk_id $tr - db_dml new_dependency { *SQL* } + pm::process::add_dependency \ + -process_task_id $tsk_id \ + -parent_task_id $parent_tsk_id \ + -dependency_type_id $type_id } } -edit_data { @@ -123,19 +135,19 @@ set process_task_id_pass [string map {"-" " "} $process_task_id_pass] set process_task_id $process_task_id_pass - foreach tsk_id $process_task_id { - db_dml delete_dependency { } - } + pm::process::remove_dependency -process_task_id $process_task_id - foreach tr $use_dependency { + foreach tr $use_dependency_list { set type_id $dependency_type($tr) set parent_tsk_id $dependency_task_id($tr) - set dependency_id [db_nextval pm_task_dependency_seq] set tsk_revision_id $tr set tsk_id [db_string get_task_id { }] - db_dml new_dependency { *SQL* } + pm::process::add_dependency \ + -process_task_id $tsk_id \ + -parent_task_id $parent_tsk_id \ + -dependency_type_id $type_id } } -after_submit { @@ -162,22 +174,17 @@ lappend dependency_keys $dependency_tasks(task_title) } -set dependency_keys [lsort $dependency_keys] - - - - # get the information on tasks from their task_id numbers db_foreach dependency_query { } -column_array tasks { # set up the tasks that can be viewed. Takes out the current task - set dependency_options_full "" + set dependency_options_full [list] foreach key $dependency_keys { if {![string equal $key $tasks(task_title)]} { - append dependency_options_full "{\"$key\" $dependency_options($key)} " + lappend dependency_options_full [list $key $dependency_options($key)] } } @@ -186,7 +193,8 @@ {value {$tasks(task_id)}} } - {task_title.$tasks(task_id):text(inform) + {task_title.$tasks(task_id):text(hidden) + {section {$tasks(task_title)}} {label \"Subject\"} {value {$tasks(task_title)}} } Index: openacs-4/contrib/packages/project-manager/www/process-one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-one-postgresql.xql,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/project-manager/www/process-one-postgresql.xql 11 Dec 2003 21:39:44 -0000 1.3 +++ openacs-4/contrib/packages/project-manager/www/process-one-postgresql.xql 25 Jun 2004 00:04:42 -0000 1.4 @@ -10,11 +10,16 @@ t.estimated_hours_work, t.estimated_hours_work_min, t.estimated_hours_work_max, - d.dependency_type + d.dependency_type, + t.ordering FROM - pm_process_task t LEFT JOIN pm_process_task_dependency d ON t.process_task_id = d.process_task_id + pm_process_task t + LEFT JOIN + pm_process_task_dependency d + ON t.process_task_id = d.process_task_id WHERE t.process_id = :process_id + [template::list::orderby_clause -orderby -name tasks] 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.10 -r1.11 --- openacs-4/contrib/packages/project-manager/www/process-one.tcl 27 Apr 2004 00:49:29 -0000 1.10 +++ openacs-4/contrib/packages/project-manager/www/process-one.tcl 25 Jun 2004 00:04:42 -0000 1.11 @@ -14,7 +14,8 @@ } { process_id:integer - + orderby:optional + } -properties { process_id:onevalue context_bar:onevalue @@ -34,60 +35,105 @@ set write_p [permission::permission_p -object_id $package_id -privilege write] set create_p [permission::permission_p -object_id $package_id -privilege create] +set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] + # set up context bar, needs parent_id - set context_bar [ad_context_bar [list "processes?process_id=$process_id" "Processes"] "One"] set use_link "" +if {[string is true $use_uncertain_completion_times_p]} { + set elements [list \ + one_line { + label "Subject" + display_template {@tasks.one_line@ + + + + + + + + + + + + + } + } \ + description { + label "Description" + } \ + estimated_hours_work_min { + label "Work estimate min" + } \ + estimated_hours_work_max { + label "Work estimate max" + } \ + ordering { + label "Order" + } ] + +} else { + + set elements [list \ + one_line { + label "Subject" + display_template {@tasks.one_line@ + + + + + + + + + + + + + } + } \ + description { + label "Description" + } \ + estimated_hours_work { + label "Work estimate" + } \ + ordering { + label "Order" + } ] +} + + + # Process tasks, using list-builder --------------------------------- template::list::create \ -name tasks \ -multirow tasks \ -key process_task_id \ - -elements { + -elements $elements \ + -orderby { + default_value ordering,asc + ordering { + label "Order" + orderby_asc "t.ordering, t.process_task_id" + orderby_desc "t.ordering desc, t.process_task_id desc" + default_direction asc + } one_line { - label "Subject" - display_template {@tasks.one_line@ - - - - - - - - - - - - - } + orderby_asc "t.one_line, t.ordering" + orderby_desc "t.one_line desc, t.ordering desc" + default_direction asc } - description { - label "Description" - } - estimated_hours_work { - label "Work estimate" - } - estimated_hours_work_min { - label "Work estimate min" - } - estimated_hours_work_max { - label "Work estimate max" - } - } \ - -orderby { - one_line {orderby one_line} - description {orderby description} estimated_hours_work {orderby estimated_hours_work} estimated_hours_work_min {orderby estimated_hours_work_min} estimated_hours_work_max {orderby estimated_hours_work_max} - default_value one_line,desc + } \ - -orderby_name orderby_tasks \ -bulk_actions { "Edit" "process-task-add-edit" "Edit tasks" "Delete" "process-task-delete" "Delete tasks" @@ -100,6 +146,7 @@ narrow } \ -filters { + process_id {} } \ -html { width 100% 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.3 -r1.4 --- openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2-postgresql.xql 10 Oct 2003 22:51:04 -0000 1.3 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2-postgresql.xql 25 Jun 2004 00:04:43 -0000 1.4 @@ -10,15 +10,17 @@ description, estimated_hours_work, estimated_hours_work_min, - estimated_hours_work_max) + estimated_hours_work_max, + ordering) values (:task_id, :process_id, :one_line, :desc, :work, :work_min, - :work_max) + :work_max, + :order) @@ -29,7 +31,8 @@ description = :desc, estimated_hours_work = :work, estimated_hours_work_min = :work_min, - estimated_hours_work_max = :work_max + estimated_hours_work_max = :work_max, + ordering = :order where process_task_id = :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.9 -r1.10 --- openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl 22 Jun 2004 00:25:55 -0000 1.9 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl 25 Jun 2004 00:04:43 -0000 1.10 @@ -17,18 +17,44 @@ } { process_id:integer,notnull - {task_title:multiple ""} - {description:multiple ""} - {estimated_hours_work:multiple ""} - {estimated_hours_work_min:multiple ""} - {estimated_hours_work_max:multiple ""} + {task_title:array ""} + {description:array ""} + {estimated_hours_work:array ""} + {estimated_hours_work_min:array ""} + {estimated_hours_work_max:array ""} + {ordering:array ""} + {assignee:multiple ""} process_task_id:integer,multiple - {use_dependency:integer,multiple ""} + {use_dependency:array ""} } -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]} { + + set flag1 0 + set flag2 0 + + foreach {index value} [array get estimated_hours_work] { + if {[empty_string_p $value]} { + set flag1 1 + } + } + + foreach {index value} [array get estimated_hours_work_min] { + if {[empty_string_p $value]} { + set flag2 1 + } + } + + foreach {index value} [array get estimated_hours_work_max] { + if {[empty_string_p $value]} { + set flag2 1 + } + } + + if {[string is true $flag1] && [string is false $flag2]} { ad_complain + } elseif {[string is false $flag1] && [string is true $flag2]} { + ad_complain } } process_id_missing { @@ -37,21 +63,28 @@ } } task_title_too_long { - foreach tt $task_title { + foreach {index tt} [array get task_title] { if {[string length $tt] > 198} { ad_complain } } } description_too_long { - foreach d $description { + foreach {index d} [array get description] { if {[string length $d] > 3998} { ad_complain } } } + description_empty { + foreach {index d} [array get description] { + if {[empty_string_p $d]} { + ad_complain + } + } + } bad_estimated_hours_work_range { - foreach wr $estimated_hours_work { + foreach {index wr} [array get estimated_hours_work] { if {$wr > 500 || $wr < 0} { ad_complain } @@ -65,11 +98,11 @@ } } } -errors { - no_estimated_hours {You must enter estimated hours. If nothing - else, enter 0 for the estimated hours} + 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} + description_empty {The description may not be empty} bad_estimated_hours_work_range {The estimated hours must be between 0 and 499 hours} process_task_id_missing {I don't know which process task is being added or edited!} } @@ -99,20 +132,25 @@ # ----------------------------- set index 0 + set array_index 0 + foreach ptid $process_task_id { + + set array_index [expr $index +1] # set up the values set task_id [lindex $process_task_id $index] - set one_line [lindex $task_title $index] - set desc [lindex $description $index] + set one_line $task_title($array_index) + set desc $description($array_index) + set order $ordering($array_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_min $estimated_hours_work_min($array_index) + set work_max $estimated_hours_work_max($array_index) set work [expr .5 * [expr $work_max - $work_min] + $work_min] } else { - set work [lindex $estimated_hours_work $index] + set work $estimated_hours_work($array_index) set work_min $work set work_max $work } @@ -131,20 +169,25 @@ # ----------------------------- set index 0 + set array_index 0 + foreach ptid $process_task_id { + set array_index [expr $index +1] + # set up the values set task_id [lindex $process_task_id $index] - set one_line [lindex $task_title $index] - set desc [lindex $description $index] + set one_line $task_title($array_index) + set desc $description($array_index) + set order $ordering($array_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_min $estimated_hours_work_min($array_index) + set work_max $estimated_hours_work_max($array_index) set work [expr .5 * [expr $work_max - $work_min] + $work_min] } else { - set work [lindex $estimated_hours_work $index] + set work $estimated_hours_work($array_index) set work_min $work set work_max $work } @@ -154,38 +197,38 @@ } } -if {1 == 0} { - set revision_has_dependencies [list] - set revision_no_dependencies [list] +# remove assignments +foreach ptid $process_task_id { - 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)] - } + pm::process::remove_assignees \ + -process_task_id $process_task_id - 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) - } +foreach ass $assignee { - # do the actual edit - db_dml edit_task { } + regexp {(.*)-(.*)-(.*)} $ass match process_task party_id role_id - 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 - } + pm::process::assign \ + -process_task_id $process_task \ + -party_id $party_id \ + -role_id $role_id - } +} +if {[llength $process_task_id] > 1} { + set task_tasks tasks +} else { + set task_tasks task } +if {[llength [array get use_dependency]] > 0} { + set dep_msg "Now set up dependencies" +} else { + set dep_msg "" +} -ad_returnredirect -message "Process task saved" "process-task-assign-add-edit?[export_vars -url {use_dependency:multiple process_id process_task_id:multiple}]" +ad_returnredirect -message "Process $task_tasks saved. $dep_msg" "process-dependency-add-edit?[export_vars -url {process_task_id:multiple process_id use_dependency:array}]" + ad_script_abort 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.5 -r1.6 --- openacs-4/contrib/packages/project-manager/www/process-task-add-edit-postgresql.xql 10 Oct 2003 22:51:04 -0000 1.5 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit-postgresql.xql 25 Jun 2004 00:04:43 -0000 1.6 @@ -10,13 +10,17 @@ t.estimated_hours_work, t.estimated_hours_work_min, t.estimated_hours_work_max, - d.dependency_type + d.dependency_type, + t.ordering FROM - pm_process_task t LEFT JOIN pm_process_task_dependency d ON t.process_task_id = d.process_task_id + pm_process_task t + LEFT JOIN + pm_process_task_dependency d + ON t.process_task_id = d.process_task_id WHERE t.process_task_id in ([join $process_task_id ", "]) ORDER BY - t.process_task_id + t.ordering, t.process_task_id 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.7 -r1.8 --- openacs-4/contrib/packages/project-manager/www/process-task-add-edit.adp 10 Nov 2003 19:34:54 -0000 1.7 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit.adp 25 Jun 2004 00:04:43 -0000 1.8 @@ -1,66 +1,85 @@ -@context_bar;noquote@ -@title@ + @context_bar;noquote@ + @title@ -
+
- - - +
+ + - - - - - - + + + + + + - + - + Description:
+ - + - + Order - - +
- - + + + + + + + + + + + + + - -
 @num.rownum@   @num.rownum@  Subject:*

+

Subject:*

- Description:

- - - - + + + + + + + -

+

Work required:*
+ + + + - - - - - - - - - - - + + + + -
Work required:*
Min: hrs
Max: hrs
hrs
Min: hrs
+
Max: hrs
hrs
- - depends on another @task_term_lower@ +

-
+ + depends on another @task_term_lower@ + +

- -

@num.assignee_html;noquote@
-
+ + + + + + + + + + +
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.10 -r1.11 --- openacs-4/contrib/packages/project-manager/www/process-task-add-edit.tcl 22 Jun 2004 00:25:55 -0000 1.10 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit.tcl 25 Jun 2004 00:04:43 -0000 1.11 @@ -52,13 +52,19 @@ set task_term_lower [parameter::get -parameter "taskname" -default "task"] set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] +set DEFAULT_ORDERING_GAP 5 + # -------------------------------------- # the unique identifier for this package # -------------------------------------- set package_id [ad_conn package_id] set user_id [ad_maybe_redirect_for_registration] +set subsite_id [ad_conn subsite_id] +set user_group_id [application_group::group_id_from_package_id \ + -package_id $subsite_id] + # ----------- # permissions # ----------- @@ -71,10 +77,9 @@ 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"] + set context_bar [ad_context_bar [list "process-one?process_id=$process_id" "Process"] "Edit tasks"] permission::require_permission -party_id $user_id -object_id $package_id -privilege write set process_tasks [list] @@ -87,7 +92,12 @@ 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 - + set ordering_v($i) $ordering + + if {[empty_string_p $ordering_v($i)]} { + set ordering_v($i) [expr $i * $DEFAULT_ORDERING_GAP] + } + if {[exists_and_not_null dependency_type]} { set checked_v($i) "checked" } else { @@ -102,7 +112,7 @@ 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"] + set context_bar [ad_context_bar [list "process-one?process_id=$process_id" "Process"] "Add tasks"] permission::require_permission -party_id $user_id -object_id $package_id -privilege create for {set i 1} {$i <= $number} {incr i} { @@ -112,27 +122,99 @@ set estimated_hours_work_v($i) "" set estimated_hours_work_min_v($i) "" set estimated_hours_work_max_v($i) "" + set ordering_v($i) [expr $i * $DEFAULT_ORDERING_GAP] set checked_v($i) "" } } +# set up assignees and roles -template::multirow create num process_task_id one_line description work work_min work_max checked +set roles_list_of_lists [pm::role::select_list_filter] +set assignee_list_of_lists [db_list_of_lists get_assignees { + select + p.first_names || ' ' || p.last_name as name, + p.person_id + FROM + persons p, + acs_rels r, + membership_rels mr + WHERE + r.object_id_one = :user_group_id and + mr.rel_id = r.rel_id and + p.person_id = r.object_id_two and + member_state = 'approved' + ORDER BY + p.first_names, p.last_name +}] + + + +template::multirow create num process_task_id one_line description work work_min work_max ordering checked assignee_html + for {set i 1} {$i <= $number} {incr i} { if {[string is false $edit_p]} { set process_task_id_tmp [db_nextval pm_process_task_seq] } else { set process_task_id_tmp [lindex $process_task_id [expr $i-1]] + + # remember all the assignees for this task + db_foreach assignee_query { + SELECT + a.party_id, + a.role_id + FROM + pm_process_task_assignment a + WHERE + a.process_task_id = :process_task_id_tmp + ORDER BY + a.role_id + } { + set assigned($process_task_id_tmp-$party_id-$role_id) 1 + } + } - 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) $checked_v($i) + # we set up the assignments by using this convention: + # {process_task_id}-{party_id}-{role_id} -} + set html "" + foreach role_list $roles_list_of_lists { + + set role_name [lindex $role_list 0] + set role [lindex $role_list 1] + + append html " + " + } + append html "

Assignee: $role_name

" + + foreach assignee_list $assignee_list_of_lists { + set name [lindex $assignee_list 0] + set person_id [lindex $assignee_list 1] + + if {[exists_and_not_null assigned($process_task_id_tmp-$person_id-$role)]} { + set checked "checked" + } else { + set checked "" + } + + append html " + $name +
+ " + + } + + append html "

" + 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) $ordering_v($i) $checked_v($i) $html +} + + Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/www/process-task-assign-add-edit-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/www/process-task-assign-add-edit.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.12 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/www/process-task-assign-add-edit.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/contrib/packages/project-manager/www/processes-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/processes-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/project-manager/www/processes-postgresql.xql 15 Sep 2003 23:09:57 -0000 1.1 +++ openacs-4/contrib/packages/project-manager/www/processes-postgresql.xql 25 Jun 2004 00:04:43 -0000 1.2 @@ -1,6 +1,6 @@ -postgresql7.2 +postgresql7.3 @@ -12,6 +12,8 @@ to_char(p.creation_date,'Mon DD ''YY') as creation_date FROM pm_process p + ORDER BY + p.one_line 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.18 -r1.19 --- openacs-4/contrib/packages/project-manager/www/task-add-edit-postgresql.xql 14 May 2004 23:08:57 -0000 1.18 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit-postgresql.xql 25 Jun 2004 00:04:43 -0000 1.19 @@ -16,6 +16,7 @@ WHERE t.process_id = :process_id ORDER BY + t.ordering, t.process_task_id 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.38 -r1.39 --- openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 22 Jun 2004 00:25:55 -0000 1.38 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 25 Jun 2004 00:04:43 -0000 1.39 @@ -735,9 +735,10 @@ # what is the task that the process says this task # depends on? set process_index [expr $i - 1] - - if {[exists_and_not_null dependency_v([lindex $process_tasks $process_index])]} { - set process_depend $dependency_v([lindex $process_tasks $process_index]) + set this_process [lindex $process_tasks $process_index] + + if {[exists_and_not_null dependency_v($this_process)]} { + set process_depend $dependency_v($this_process) } else { set process_depend "XXX" } @@ -747,15 +748,18 @@ # one. So we add one to this index, as long as the value # is not -1 (which indicates that process_depend is not in # the process_tasks list) + # can have more than one match, so we use -all - set which_dep_task [lsearch $process_tasks $process_depend] + set which_dep_task_list [lsearch -all $process_tasks $process_depend] - if {$which_dep_task >= 0} { - incr which_dep_task - } + foreach which_dep $which_dep_task_list { - if {$which_dep_task == $process_index} { - set dependency_arr($i) "num$which_dep_task" + # indexes are from 0, we want from 1 + incr which_dep + + # num1 is a convention, used to indicate dependencies + # on tasks that haven't been created yet. + set dependency_arr($i) "num$which_dep" } }