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.19 -r1.20 --- openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 18 Sep 2003 23:33:54 -0000 1.19 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 6 Oct 2003 22:57:28 -0000 1.20 @@ -1,12 +1,3 @@ -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 -} - ad_page_contract { Add/edit form for tasks @@ -28,6 +19,7 @@ @param task_id Specifies the item for the task (every revision of a task shares the same task_id) Also used as the key for the ad_form. For this reason, when editing, we have to pass in task_iid instead @param my_key if set, then ad_form knows that this is an edit @param task_title + @param process_id The process we're using to create this task @param use_dependency_p Whether or not to use dependencies with this task @param use_uncertain_completion_times_p Whether or not to use PERT-style completion time uncertainty 1 = yes } { @@ -40,6 +32,7 @@ task_id:integer,multiple,optional task_item_id:array,optional task_title:array,optional + {process_id:integer ""} use_dependency_p:array,optional description:array,optional name:array,optional @@ -77,11 +70,45 @@ # --------------------------------------------------------------- # +set user_id [ad_maybe_redirect_for_registration] +set package_id [ad_conn package_id] + +# terminology +set project_term [parameter::get -parameter "ProjectName" -default "Project"] +set task_term [parameter::get -parameter "TaskName" -default "Task"] +set task_term_lower [parameter::get -parameter "taskname" -default "task"] +set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] + + if {![exists_and_not_null project_id]} { set project_id [db_string get_project_id { }] } +# -------------------------------------------------------------------- +# If we are using a process, then we need to get the information on +# the process now. This is necessary because we need to do things like +# set the number of tasks we're going to be entering. We save this for +# later, so we can get the values +# -------------------------------------------------------------------- + +set process_tasks [list] + +if {[info exists 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 + + lappend process_tasks $process_task_id + } + + 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 @@ -150,17 +177,6 @@ } } -# terminology -set project_term [parameter::get -parameter "ProjectName" -default "Project"] -set task_term [parameter::get -parameter "TaskName" -default "Task"] -set task_term_lower [parameter::get -parameter "taskname" -default "task"] -set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] - - -# the unique identifier for this package -set package_id [ad_conn package_id] -set user_id [ad_maybe_redirect_for_registration] - # permissions and more if {[exists_and_not_null task_id]} { @@ -310,7 +326,6 @@ set use_dependency_arr($i) "" } - # ----------------------------------------------------- # if we are editing the tasks, then we want to show the # percent_complete @@ -336,6 +351,13 @@ } } else { + # ---------------------------------------------------------- + # if we are using a process, then we want to fill in all the + # default values for the user. + # ---------------------------------------------------------- + + # get the values + for {set i 1} {$i <= $number} {incr i} { set task_title_arr($i) "" set description_arr($i) "" @@ -349,6 +371,20 @@ set actual_hours_worked_arr($i) 0 set task_item_id_arr($i) "" + if {[info exists process_id]} { + + set ptask_id [lindex $process_tasks [expr $i-1]] + + set task_title_arr($i) $one_line_v($ptask_id) + set description_arr($i) $description_v($ptask_id) + 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) + + # still need to add in dependency information + # and assignment information + } + # ----------------------------------------------------- # for new tasks, we hide the percent_complete # -----------------------------------------------------