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.1 -r1.2
--- openacs-4/packages/assessment/tcl/as-checks-procs-postgresql.xql 24 Jan 2005 17:59:52 -0000 1.1
+++ openacs-4/packages/assessment/tcl/as-checks-procs-postgresql.xql 27 Jan 2005 18:07:37 -0000 1.2
@@ -9,12 +9,30 @@
-
-
select nextval('as_actions_log_action_log_id')
+
+
+ select inter_item_check_id,action_p,check_sql,postcheck_p,section_id_from,section_id_to,item_id,name,description from as_inter_item_checks where section_id_from=:section_id
+
+
+
+
+
+
+ select as_inter_item_check__new (null,:action_p,:section_id_from,null,:check_sql,:name,:description,:postcheck_p,null,:user_id,null)
+
+
+
+
+
+
+ select as_inter_item_check__delete (:check_id)
+
+
+
\ No newline at end of file
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.6 -r1.7
--- openacs-4/packages/assessment/tcl/as-checks-procs.tcl 26 Jan 2005 23:14:29 -0000 1.6
+++ openacs-4/packages/assessment/tcl/as-checks-procs.tcl 27 Jan 2005 18:07:37 -0000 1.7
@@ -456,11 +456,74 @@
return $display_info
}
-ad_proc -public as::assessment::check::copy_checks{
+ad_proc -public as::assessment::check::copy_checks {
{-section_id:required}
{-new_section_id:required}
} {
} {
+ set user_id [ad_conn user_id]
+ set checks [db_list_of_lists get_checks {}]
+ foreach check $checks {
+ set inter_item_check_id [lindex $check 0]
+ set action_p [lindex $check 1]
+ set check_sql [lindex $check 2]
+ set postcheck_p [lindex $check 3]
+ set section_id_from $new_section_id
+ set section_id_to [lindex $check 5]
+ set item_id [lindex $check 6]
+ set name [lindex $check 7]
+ set description [lindex $check 8]
+
+ set insert_p [db_exec_plsql copy_check {}]
+
+ # copy action map
+
+ 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 {}
+ }
+
+ }
+
+ }
+
+ }
+ #update other checks
+ update_checks -section_id $section_id -new_section_id $new_section_id
+}
+
+ad_proc -public as::assessment::check::update_checks {
+ {-section_id:required}
+ {-new_section_id:required}
+} {
+
+} {
+ set checks [db_list_of_lists checks {}]
+ foreach check_id $checks {
+ db_dml update_check {}
+ }
+}
+
+ad_proc -public as::assessment::check::delete_assessment_checks {
+ {-assessment_rev_id:required}
+} {
+
+} {
+ set checks [db_list_of_lists assessment_checks {}]
+ foreach check_id $checks {
+ set delete_p [db_exec_plsql delete_checks {}]
+ }
}
\ 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.3 -r1.4
--- openacs-4/packages/assessment/tcl/as-checks-procs.xql 26 Jan 2005 23:14:29 -0000 1.3
+++ openacs-4/packages/assessment/tcl/as-checks-procs.xql 27 Jan 2005 18:07:37 -0000 1.4
@@ -311,5 +311,48 @@
+
+
+ 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)
+
+
+
+
+
+ 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)
+
+
+
+
+
+ select inter_item_check_id from as_inter_item_checks where section_id_to =:section_id
+
+
+
+
+
+ update as_inter_item_checks set section_id_to=:new_section_id where inter_item_check_id=:check_id
+
+
+
+
+
+ select inter_item_check_id from as_inter_item_checks where section_id_from in (select s.section_id from as_sections s, cr_revisions cr, cr_items ci, as_assessment_section_map asm where ci.item_id = cr.item_id and cr.revision_id = s.section_id and s.section_id = asm.section_id and asm.assessment_id =:assessment_rev_id)
+
+
+