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.18 -r1.19 --- openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 18 Sep 2003 01:09:14 -0000 1.18 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 18 Sep 2003 23:33:54 -0000 1.19 @@ -1,3 +1,12 @@ +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 @@ -16,17 +25,19 @@ @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_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 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 } { + my_key:integer,optional project_item_id:integer,optional project_id:integer,optional {number:integer "1"} task_revision_id:integer,optional - task_id:multiple,integer,optional + task_id:integer,multiple,optional task_item_id:array,optional task_title:array,optional use_dependency_p:array,optional @@ -70,16 +81,8 @@ set project_id [db_string get_project_id { }] } -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 -} -if {[info exists task_id] && ![info exists __new_p]} { +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 @@ -143,6 +146,7 @@ for {set i 1} {$i <= $number} {incr i} { # set up date variable names set end_date_$i [list $end_date_year($i) $end_date_month($i) $end_date_day($i) {} {} {}] + ns_log Notice "End date $i: [set end_date_$i]" } } @@ -171,7 +175,7 @@ ad_form -name add_edit -form { - task_id:key + my_key:key(acs_object_id_seq) {project_item_id:text(hidden) {value $project_item_id} @@ -192,6 +196,8 @@ } -new_data { + ns_log Notice "new data" + # -------------------------------------------------------------- # each task we add in returns a task_revision_id # we set up two lists, one for tasks that will need dependencies @@ -217,7 +223,7 @@ set this_revision_id [db_exec_plsql new_task_item { *SQL* }] - if {[info exists use_dependency_p($i)] && [string equal $use_dependency_p($i) "t"]} { + 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 @@ -253,13 +259,15 @@ 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" + # BUG: we need to make sure we take care of deleting dependencies # if unchecked, adding dependencies, etc.. if {[info exists use_dependency_p($i)] && [string equal $use_dependency_p($i) "t"]} { - #lappend revision_has_dependencies $this_revision_id + lappend revision_has_dependencies $this_revision_id } else { - #lappend revision_no_dependencies $this_revision_id + lappend revision_no_dependencies $this_revision_id } } @@ -280,7 +288,7 @@ # we set the values for edited tasks # ---------------------------------- -if {[info exists task_id]} { +if {![ad_form_new_p -key task_id]} { set i 1 @@ -356,7 +364,7 @@ ] \ [list actual_hours_worked.$i:text(hidden) \ {label "Hours worked"} \ - {html {size 4}} \ + {html {size 6}} \ {value {$actual_hours_worked_arr($i)}} \ ] ] @@ -400,7 +408,7 @@ [list \ use_dependency_p.$i:text(checkbox) \ {label "Use dependency"} \ - {options {{"" "t"}}} \ + {options {{"" "on"}}} \ {html $use_dependency_arr($i)} \ ] \ [list \ @@ -421,13 +429,13 @@ [list \ estimated_hours_work_min.$i:integer \ {label "Hours estimate - min"} \ - {html {size 3}} \ + {html {size 5}} \ {value {$estimated_hours_min_arr($i)}} \ ] \ [list \ estimated_hours_work_max.$i:integer \ {label "Hours estimate - max"} \ - {html {size 3}} \ + {html {size 5}} \ {value {$estimated_hours_max_arr($i)}} \ ] \ ] @@ -439,7 +447,7 @@ [list \ estimated_hours_work.$i:integer \ {label "Hours estimate"} \ - {html {size 3}} \ + {html {size 5}} \ {value {$estimated_hours_arr($i)}} \ ] \ ]