Index: openacs-4/packages/lors/tcl/apm-callbacks-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/apm-callbacks-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/lors/tcl/apm-callbacks-procs.tcl 17 Nov 2008 13:35:02 -0000 1.3 +++ openacs-4/packages/lors/tcl/apm-callbacks-procs.tcl 3 Dec 2008 12:36:42 -0000 1.4 @@ -29,9 +29,7 @@ set creation_ip [ad_conn peeraddr] # We get all manifest from copy table so we can create a new cr_item and revision for each one of them - set manifests_list [db_list_of_lists get_all_manifests { - select * - from ims_cp_manifests_copy }] + set manifests_list [db_list_of_lists get_all_manifests {}] foreach man_info $manifests_list { set original_man_id [lindex $man_info 0] @@ -48,11 +46,7 @@ set package_id [lindex $man_info 11] # First we create the folder that will hold all new cr_items - db_1row get_folder_info { - select name as cr_dir, parent_id - from cr_items - where item_id = :folder_id - } + db_1row get_folder_info {} set items_parent_id [lors::cr::add_folder \ -parent_id $parent_id \ @@ -78,37 +72,15 @@ -is_live "t"] # We Update the extra information - db_dml update_new_manifest { - update ims_cp_manifests - set course_name = :course_name, - identifier = :man_identifier, - version = :version, - orgs_default = :orgs_default, - hasmetadata = :hasmetadata, - parent_man_id = :parent_man_id, - isscorm = :isscorm, - folder_id = :folder_id, - fs_package_id = :fs_package_id, - isshared = :isshared - where man_id = :new_man_revision_id - } + db_dml update_new_manifest {} # We are going to associate the new manifest to classes - db_dml update_manifest_class { - update ims_cp_manifest_class_copy - set man_id = :new_man_revision_id - where man_id = :original_man_id - } + db_dml update_manifest_class {} - db_dml insert_manifest_class { - insert into ims_cp_manifest_class( man_id, lorsm_instance_id, community_id, class_key, isenabled,istrackable) - select * - from ims_cp_manifest_class_copy - where man_id = :new_man_revision_id - } + db_dml insert_manifest_class {} # Now we want to do the same thing for resources but we need to keep the references to the original man_id - set resources_list [db_list_of_lists get_resources { select * from ims_cp_resources_copy where man_id = :original_man_id }] + set resources_list [db_list_of_lists get_resources {}] foreach res_info $resources_list { set original_res_id [lindex $res_info 0] set man_id $new_man_revision_id @@ -139,42 +111,18 @@ -is_live "t"] # We Update the extra information - db_dml update_new_resource { - update ims_cp_resources - set man_id = :man_id, - identifier = :res_identifier, - type = :type, - href = :href, - hasmetadata = :hasmetadata, - scorm_type = :scorm_type - where res_id = :new_res_revision_id - } + db_dml update_new_resource {} - db_dml update_ims_item_to_resources_copy_res { - update ims_cp_items_to_resources_copy - set new_res_id = :new_res_revision_id - where res_id = :original_res_id - } + db_dml update_ims_item_to_resources_copy_res {} # Now we need to relate all files that are stored on the db - db_dml update_ims_cp_files_copy { - update ims_cp_files_copy - set res_id = :new_res_revision_id - where res_id = :original_res_id - } + db_dml update_ims_cp_files_copy {} - db_dml insert_ims_cp_files { - insert into ims_cp_files (file_id, res_id, pathtofile, filename, hasmetadata) - select cr.live_revision as file_id, if.res_id, if.pathtofile, if.filename,if.hasmetadata - from ims_cp_files_copy if, cr_items cr - where if.res_id = :new_res_revision_id - and if.file_id = cr.item_id - } + db_dml insert_ims_cp_files {} }; # END foreach res_info # Now we want to do the same thing for organizations but we need to keep the references to the original man_id - set organizations_list [db_list_of_lists get_organizations { select * - from ims_cp_organizations_copy where man_id = :original_man_id }] + set organizations_list [db_list_of_lists get_organizations {}] foreach org_info $organizations_list { set original_org_id [lindex $org_info 0] set org_man_id $new_man_revision_id @@ -204,20 +152,10 @@ -is_live "t"] # We Update the extra information - db_dml update_new_organization { - update ims_cp_organizations - set man_id = :org_man_id, - identifier = :org_identifier, - structure = :structure, - org_title = :org_title, - hasmetadata = :hasmetadata, - isshared = :isshared - where org_id = :new_org_revision_id - } + db_dml update_new_organization {} # Now we process the ims_items - set items_list [db_list_of_lists get_items { select * - from ims_cp_items_copy where org_id = :original_org_id }] + set items_list [db_list_of_lists get_items {}] set sort_order 0 foreach item_info $items_list { set original_item_id [lindex $item_info 0] @@ -259,43 +197,15 @@ -is_live "t"] # We Update the extra information - db_dml update_new_ims_item { - update ims_cp_items - set org_id = :new_org_revision_id, - identifier = :item_identifier, - identifierref = :identifierref, - isvisible = :isvisible, - parameters = :parameters, - ims_item_title = :ims_item_title, - parent_item = :parent_item, - hasmetadata = :hasmetadata, - prerequisites_t = :prerequisites_t, - prerequisites_s = :prerequisites_s, - type = :type, - maxtimeallowed = :maxtimeallowed, - timelimitaction = :timelimitaction, - datafromlms = :datafromlms, - masteryscore = :masteryscore, - isshared = :isshared, - sort_order = :sort_order - where ims_item_id = :new_ims_revision_id - } + db_dml update_new_ims_item {} - db_dml update_ims_item_to_resources_copy { - update ims_cp_items_to_resources_copy - set new_ims_item_id = :new_ims_revision_id - where item_id = :original_item_id - } + db_dml update_ims_item_to_resources_copy {} }; # END foreach item_info }; # END foreach org_info }; # END foreach man_info # Now relate the new ims_item_id to the new res_id - db_dml update_ims_cp_itr { - insert into ims_cp_items_to_resources (ims_item_id, res_id) - select new_ims_item_id as ims_item_id, new_res_id as res_id - from ims_cp_items_to_resources_copy - } + db_dml update_ims_cp_itr {} db_dml drop_tables {drop table ims_cp_items_to_resources_copy}