Index: openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-dependency-add-edit.tcl,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.tcl 20 May 2004 17:30:05 -0000 1.6.2.1 +++ openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.tcl 2 Jul 2004 23:13:49 -0000 1.6.2.2 @@ -15,7 +15,8 @@ } { - {use_dependency:multiple ""} + {use_dependency:array ""} + {use_dependency_list:multiple ""} process_id:integer dependency_id:integer,optional process_task_id:multiple,optional @@ -34,7 +35,13 @@ # --------------------------------------------------------------- # +# turn the use_dependency +if {[llength [array get use_dependency]] > 0} { + foreach {index value} [array get use_dependency] { + lappend use_dependency_list $value + } +} # HACK because there isn't a facility for exporting multiple hidden # form variables in ad_form @@ -43,12 +50,15 @@ set process_task_id_pass [string map {"-" " "} $process_task_id_pass] set process_task_id $process_task_id_pass -set use_dependency_pass $use_dependency -set use_dependency_pass [string map {"-" " "} $use_dependency_pass] -set use_dependency $use_dependency_pass +set use_dependency_list_pass $use_dependency_list +set use_dependency_list_pass [string map {"-" " "} $use_dependency_list_pass] +set use_dependency_list $use_dependency_list_pass -if {![exists_and_not_null use_dependency]} { +if {![exists_and_not_null use_dependency_list]} { + pm::process::remove_dependency \ + -process_task_id $process_task_id + ad_returnredirect "process-one?[export_url_vars process_id]" ad_script_abort } @@ -69,7 +79,7 @@ permission::require_permission -party_id $user_id -object_id $package_id -privilege create set process_task_id_pass [string map {" " "-"} $process_task_id] -set use_dependency_pass [string map {" " "-"} $use_dependency] +set use_dependency_list_pass [string map {" " "-"} $use_dependency_list] ad_form -name add_edit -form { dependency_id:key(pm_process_task_dependency_seq) @@ -78,8 +88,8 @@ {value $process_task_id_pass} } - {use_dependency:text(hidden) - {value $use_dependency_pass} + {use_dependency_list:text(hidden) + {value $use_dependency_list_pass} } {process_id:text(hidden) @@ -99,22 +109,24 @@ # convert from our hack back to a list set process_task_id [string map {"-" " "} $process_task_id] - foreach tsk_id $process_task_id { - db_dml delete_dependency { } - } + pm::process::remove_dependency \ + -process_task_id $process_task_id # convert from our hack back to a list - set use_dependency [string map {"-" " "} $use_dependency] + set use_dependency_list [string map {"-" " "} $use_dependency_list] - foreach tr $use_dependency { + foreach tr $use_dependency_list { set type_id $dependency_type($tr) set parent_tsk_id $dependency_task_id($tr) - set dependency_id [db_nextval pm_task_dependency_seq] + set tsk_revision_id $tr set tsk_id $tr - db_dml new_dependency { *SQL* } + pm::process::add_dependency \ + -process_task_id $tsk_id \ + -parent_task_id $parent_tsk_id \ + -dependency_type_id $type_id } } -edit_data { @@ -123,24 +135,24 @@ set process_task_id_pass [string map {"-" " "} $process_task_id_pass] set process_task_id $process_task_id_pass - foreach tsk_id $process_task_id { - db_dml delete_dependency { } - } + pm::process::remove_dependency -process_task_id $process_task_id - foreach tr $use_dependency { + foreach tr $use_dependency_list { set type_id $dependency_type($tr) set parent_tsk_id $dependency_task_id($tr) - set dependency_id [db_nextval pm_task_dependency_seq] set tsk_revision_id $tr set tsk_id [db_string get_task_id { }] - db_dml new_dependency { *SQL* } + pm::process::add_dependency \ + -process_task_id $tsk_id \ + -parent_task_id $parent_tsk_id \ + -dependency_type_id $type_id } } -after_submit { - ad_returnredirect [export_vars -base process-one -url {process_id}] + ad_returnredirect -message "Process task dependencies saved" [export_vars -base process-one -url {process_id}] ad_script_abort } @@ -162,22 +174,17 @@ lappend dependency_keys $dependency_tasks(task_title) } -set dependency_keys [lsort $dependency_keys] - - - - # get the information on tasks from their task_id numbers db_foreach dependency_query { } -column_array tasks { # set up the tasks that can be viewed. Takes out the current task - set dependency_options_full "" + set dependency_options_full [list] foreach key $dependency_keys { if {![string equal $key $tasks(task_title)]} { - append dependency_options_full "{\"$key\" $dependency_options($key)} " + lappend dependency_options_full [list $key $dependency_options($key)] } } @@ -186,7 +193,8 @@ {value {$tasks(task_id)}} } - {task_title.$tasks(task_id):text(inform) + {task_title.$tasks(task_id):text(hidden) + {section {$tasks(task_title)}} {label \"Subject\"} {value {$tasks(task_title)}} }