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.12 -r1.13 --- openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 27 Aug 2003 19:15:37 -0000 1.12 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 27 Aug 2003 20:57:53 -0000 1.13 @@ -13,8 +13,11 @@ @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 + @param added_tasks @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 } { project_item_id:integer,optional @@ -24,14 +27,14 @@ task_revision_id:integer,optional task_id:multiple,integer,optional task_title:array,optional + use_constraint_p:array,optional description:array,optional name:array,optional parent_id:array,optional end_date:array,optional percent_complete:array,optional estimated_hours_work_min:array,optional estimated_hours_work_max:array,optional - {skip_constraints_p "f"} } -properties { context_bar:onevalue @@ -143,21 +146,22 @@ {value $number} } - {skip_constraints_p:text(checkbox) - {label "Skip adding constraints?"} - {options {{"" "t"}}} - {value $skip_constraints_p}} - } -on_submit { set user_id [ad_conn user_id] set peeraddr [ad_conn peeraddr] } -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 set task_revisions [list] for {set i 1} {$i <= $number} {incr i} { - lappend task_revisions [db_exec_plsql new_task_item { *SQL* }] + 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"]} { + lappend task_revisions $this_revision_id + } } project_manager::project::compute_parent_status $project_item_id @@ -166,9 +170,11 @@ } -select_query_name task_query -after_submit { - ns_log Notice "Skip constraints: $skip_constraints_p" + # 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 + # page. - if {[string equal $skip_constraints_p "t"]} { + if {[llength $task_revisions] <= 0} { ad_returnredirect "one?[export_vars -url {project_item_id}]" ad_script_abort } else { @@ -177,7 +183,7 @@ } } -for {set i 0} {$i <= $number} {incr i} { +for {set i 1} {$i <= $number} {incr i} { # reading this code, you may wonder why we put the .$i at the end. # DaveB showed me this trick. It lets you make a multiple out of @@ -196,6 +202,12 @@ {html {rows 7 cols 40}} ] \ [list \ + use_constraint_p.$i:text(checkbox) \ + {label "Use constraint"} \ + {options {{"f" "t"}}} \ + {value "t"} \ + ] \ + [list \ parent_id.$i:text(hidden) \ ] \ [list \