Index: openacs-4/packages/assessment/tcl/as-checks-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-checks-procs-oracle.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/assessment/tcl/as-checks-procs-oracle.xql 27 Feb 2005 17:07:17 -0000 1.5 +++ openacs-4/packages/assessment/tcl/as-checks-procs-oracle.xql 28 Feb 2005 22:31:58 -0000 1.6 @@ -41,7 +41,30 @@ end; + + + declare begin + :1 := as_inter_item_check.new ( + inter_item_check_id => null, + name => :name, + action_p => :action_p, + section_id_from => :section_id_from, + section_id_to => :section_id_to, + check_sql => :check_sql, + description => :description, + postcheck_p => :postcheck_p, + item_id => null, + assessment_id => :assessment_id, + creation_user => :user_id, + context_id => null, + object_type => 'as_inter_item_check', + creation_date => null + ); + end; + + + begin Index: openacs-4/packages/assessment/tcl/as-checks-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-checks-procs-postgresql.xql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/assessment/tcl/as-checks-procs-postgresql.xql 27 Feb 2005 17:07:17 -0000 1.8 +++ openacs-4/packages/assessment/tcl/as-checks-procs-postgresql.xql 28 Feb 2005 22:31:58 -0000 1.9 @@ -23,6 +23,13 @@ + + + select inter_item_check_id,action_p,check_sql,postcheck_p,section_id_from,section_id_to,item_id,name,description,assessment_id from as_inter_item_checks where section_id_from=:section_id and assessment_id=:assessment_id + + + + Index: openacs-4/packages/assessment/tcl/as-checks-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-checks-procs.tcl,v diff -u -r1.19 -r1.20 --- openacs-4/packages/assessment/tcl/as-checks-procs.tcl 21 Feb 2005 22:18:45 -0000 1.19 +++ openacs-4/packages/assessment/tcl/as-checks-procs.tcl 28 Feb 2005 22:31:58 -0000 1.20 @@ -560,4 +560,54 @@ db_exec_plsql delete_check {} } } +} + +ad_proc -public as::assessment::check::copy_item_checks { + {-assessment_id:required} + {-section_id} + {-as_item_id} + {-new_item_id} +} { + +} { + set checks [db_list_of_lists related_checks {}] + set user_id [ad_conn user_id] + foreach check $checks { + + + set cond_list [split [lindex $check 1] "="] + set item_id [lindex [split [lindex $cond_list 2] " "] 0] + set condition [lindex [split [lindex $cond_list 1] " "] 0] + + if {$item_id == $as_item_id} { + set inter_item_check_id [lindex $check 0] + set action_p [lindex $check 6] + set postcheck_p [lindex $check 8] + set section_id_from $section_id + set section_id_to [lindex $check 3] + set item_id [lindex $check 7] + set name [lindex $check 4] + set check_sql [as::assessment::check::get_sql -item_id $new_item_id -condition $condition] + set description [lindex $check 5] + + set insert_p [db_exec_plsql copy_check {}] + if { $action_p == "t"} { + set exist_p [db_0or1row get_action_map { }] + if {$exist_p == 1} { + + db_dml insert_action_map {} + # copy parameters + set parameters [db_list_of_lists parameters { }] + foreach parameter $parameters { + set parameter_id [lindex $parameter 0] + set value [lindex $parameter 1] + set item_id [lindex $parameter 2] + + db_dml copy_parameter {} + } + + } + } + } + } } \ No newline at end of file Index: openacs-4/packages/assessment/tcl/as-checks-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-checks-procs.xql,v diff -u -r1.13 -r1.14 --- openacs-4/packages/assessment/tcl/as-checks-procs.xql 21 Feb 2005 21:45:34 -0000 1.13 +++ openacs-4/packages/assessment/tcl/as-checks-procs.xql 28 Feb 2005 22:31:58 -0000 1.14 @@ -298,27 +298,56 @@ select action_id,order_by,user_message,action_perform from as_action_map where inter_item_check_id=:inter_item_check_id + + + select action_id,order_by,user_message,action_perform from as_action_map where inter_item_check_id=:inter_item_check_id + + + insert into as_action_map (inter_item_check_id,action_id,order_by,user_message,action_perform) values (:insert_p,:action_id,:order_by,:user_message,:action_perform) - + + insert into as_action_map (inter_item_check_id,action_id,order_by,user_message,action_perform) values + (:insert_p,:action_id,:order_by,:user_message,:action_perform) + + + + + + select parameter_id,value,item_id from as_param_map + where inter_item_check_id=:inter_item_check_id and action_id=:action_id + + + + + + select parameter_id,value,item_id from as_param_map where inter_item_check_id=:inter_item_check_id + insert into as_param_map (parameter_id,value,item_id,inter_item_check_id) values (:parameter_id,:value,:item_id,:insert_p) + + + insert into as_param_map (parameter_id,value,item_id,inter_item_check_id) values (:parameter_id,:value,:item_id,:insert_p) + + + + select inter_item_check_id from as_inter_item_checks where section_id_to =:section_id @@ -345,4 +374,13 @@ + + + + select inter_item_check_id,check_sql,section_id_from,section_id_to,name,description,action_p,item_id, postcheck_p from as_inter_item_checks where assessment_id=:assessment_id and section_id_from=:section_id + + + + +