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 +} + +