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.21 -r1.22 --- openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 8 Oct 2003 20:29:27 -0000 1.21 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 10 Oct 2003 22:51:04 -0000 1.22 @@ -1,3 +1,12 @@ +ns_log notice task assign add edit 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 +} + ad_page_contract { Add/edit form for tasks @@ -11,6 +20,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 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 @@ -25,6 +35,7 @@ } { my_key:integer,optional + process_task_ids:array,optional project_item_id:integer,optional project_id:integer,optional {number:integer "1"} @@ -94,25 +105,27 @@ set process_tasks [list] -if {[info exists process_id]} { +if {[exists_and_not_null process_id]} { db_foreach get_process_tasks { } { - set one_line_v($process_task_id) $one_line - set description_v($process_task_id) $description - set estimated_hours_work_v($process_task_id) $estimated_hours_work - set estimated_hours_work_min_v($process_task_id) $estimated_hours_work_min - set estimated_hours_work_max_v($process_task_id) $estimated_hours_work_max + set one_line_v($process_tid) $one_line + set description_v($process_tid) $description + set estimated_hours_work_v($process_tid) $estimated_hours_work + set estimated_hours_work_min_v($process_tid) $estimated_hours_work_min + set estimated_hours_work_max_v($process_tid) $estimated_hours_work_max + set dependency_v($process_tid) $dependency_id - lappend process_tasks $process_task_id + lappend process_tasks $process_tid } set number [llength $process_tasks] } if {![ad_form_new_p -key task_id]} { + # ----------------------------------------------------- # create a multirow we can use to iterate - # we also set the number variable so we can use that in - # this tcl file + # we also set the number variable for future use + # ----------------------------------------------------- template::multirow create num number set i 1 @@ -136,8 +149,8 @@ set edit_p f } +ns_log Notice "Edit_p: $edit_p number: $number " - # The evilest hack of all time. # ------------------------------------------------------- # This is a workaround the fact that using multiple dates @@ -242,13 +255,22 @@ set end_date_$i "{} {} {} {} {} {}" } + # 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 this_revision_id [db_exec_plsql new_task_item { *SQL* }] 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 } + + lappend process_task_id $process_task_ids($i) } } -edit_data { @@ -278,9 +300,22 @@ set estimated_hours_work_max($i) $estimated_hours_work($i) } + if {![exists_and_not_null end_date_$i]} { + set end_date_$i "{} {} {} {} {} {}" + } + + # set up variables, pulling from arrays + set p_task_item_id $task_item_id($i) + set p_task_title $task_title($i) + set p_description $description($i) + set p_percent $percent_complete($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_hours $actual_hours_worked($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* }] ns_log Notice "Added in $this_revision_id" @@ -302,7 +337,8 @@ # we add that to a list of ids that we pass to the dependency-add-edit # page. - ad_returnredirect "task-assign-add-edit?[export_vars -url {revision_has_dependencies:multiple revision_no_dependencies:multiple project_item_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_script_abort } @@ -333,6 +369,9 @@ set use_dependency_arr($i) "" } + # we are not using a process + set process_task_id_arr($i) "" + # ----------------------------------------------------- # if we are editing the tasks, then we want to show the # percent_complete @@ -377,8 +416,9 @@ set percent_complete_arr($i) 0 set actual_hours_worked_arr($i) 0 set task_item_id_arr($i) "" + set process_task_id_arr($i) "" - if {[info exists process_id]} { + if {[exists_and_not_null process_id]} { set ptask_id [lindex $process_tasks [expr $i-1]] @@ -387,9 +427,18 @@ set estimated_hours_arr($i) $estimated_hours_work_v($ptask_id) 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) "" + } - # still need to add in dependency information - # and assignment information + # 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 + set process_task_id_arr($i) $ptask_id + } # ----------------------------------------------------- @@ -439,9 +488,12 @@ ] \ [list task_item_id.$i:text(hidden) \ {label "Task item id"} \ - {html {size 4}} \ {value {$task_item_id_arr($i)}} \ ] \ + [list process_task_ids.$i:text(hidden) \ + {label "Process task id"} \ + {value {$process_task_id_arr($i)}} \ + ] \ [list \ description.$i:text(textarea),optional \ {label "Description"} \