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.13 -r1.14 --- openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 27 Aug 2003 20:57:53 -0000 1.13 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 29 Aug 2003 00:35:35 -0000 1.14 @@ -17,7 +17,8 @@ @param task_revision_id Specifies the revision this task represents (each revision of a task has a separate id) @param task_id Specifies the item for the task (every revision of a task shares the same task_id) @param task_title - @param use_constraint_p Whether or not to use constraints with 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 } { project_item_id:integer,optional @@ -27,19 +28,21 @@ task_revision_id:integer,optional task_id:multiple,integer,optional task_title:array,optional - use_constraint_p:array,optional + use_dependency_p:array,optional description:array,optional name:array,optional parent_id:array,optional end_date:array,optional percent_complete:array,optional + estimated_hours_work:array,optional estimated_hours_work_min:array,optional estimated_hours_work_max:array,optional } -properties { context_bar:onevalue title:onevalue num:multirow + use_uncertain_completion_times_p:onevalue } -validate { number_is_in_range -requires {number:integer} { @@ -110,9 +113,8 @@ 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"] -# todo make this value do something! -set use_min_max_hour_estimates_p [parameter::get -parameter "UseMinMaxTaskHourEstimatesP" -default "1"] # the unique identifier for this package set package_id [ad_conn package_id] @@ -154,12 +156,25 @@ } -new_data { # we set up a list of task_revisions to pass on to the - # add constraints page. We only add in revision_ids when the - # user has selected this task for constraints + # add dependencies page. We only add in revision_ids when the + # user has selected this task for dependencies set task_revisions [list] 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)] + } + + 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) + } + set this_revision_id [db_exec_plsql new_task_item { *SQL* }] - if {[info exists use_constraint_p($i)] && [string equal $use_constraint_p($i) "t"]} { + if {[info exists use_dependency_p($i)] && [string equal $use_dependency_p($i) "t"]} { lappend task_revisions $this_revision_id } } @@ -170,15 +185,15 @@ } -select_query_name task_query -after_submit { - # now go through the use_constraint_p items. For each that is checked, - # we add that to a list of ids that we pass to the task-constraint-add-edit + # now go through the use_dependency_p items. For each that is checked, + # we add that to a list of ids that we pass to the dependency-add-edit # page. if {[llength $task_revisions] <= 0} { ad_returnredirect "one?[export_vars -url {project_item_id}]" ad_script_abort } else { - ad_returnredirect "task-constraint-add-edit?[export_vars -url {task_revisions:multiple project_item_id}]" + ad_returnredirect "dependency-add-edit?[export_vars -url {task_revisions:multiple project_item_id}]" ad_script_abort } } @@ -194,38 +209,51 @@ [list \ task_title.$i:text \ {label "Subject \#$i"} \ - {html {size 39}} + {html {size 39}} \ ] \ [list \ - description.$i:text(textarea) \ + description.$i:text(textarea),optional \ {label "Description"} \ - {html {rows 7 cols 40}} + {html {rows 7 cols 40}} \ ] \ [list \ - use_constraint_p.$i:text(checkbox) \ - {label "Use constraint"} \ - {options {{"f" "t"}}} \ + use_dependency_p.$i:text(checkbox) \ + {label "Use dependency"} \ {value "t"} \ ] \ [list \ parent_id.$i:text(hidden) \ ] \ [list \ - end_date.$i:date,to_sql(linear_date) \ + end_date.$i:date,to_sql(linear_date),optional \ {label "Deadline"} \ {format "MONTH DD YYYY"} \ - {value {[util::date::today]}} \ {help} \ ] \ - [list \ - estimated_hours_work_min.$i:integer \ - {label "Hours estimate - min"} \ - {html {size 3}} \ - ] \ - [list \ - estimated_hours_work_max.$i:integer \ - {label "Hours estimate - max"} \ - {html {size 3}} \ - ] \ - ] + ] + + if {$use_uncertain_completion_times_p} { + ad_form -extend -name add_edit -form \ + [list \ + [list \ + estimated_hours_work_min.$i:integer \ + {label "Hours estimate - min"} \ + {html {size 3}} \ + ] \ + [list \ + estimated_hours_work_max.$i:integer \ + {label "Hours estimate - max"} \ + {html {size 3}} \ + ] \ + ] + } else { + ad_form -extend -name add_edit -form \ + [list \ + [list \ + estimated_hours_work.$i:integer \ + {label "Hours estimate"} \ + {html {size 3}} \ + ] \ + ] + } }