Index: openacs-4/packages/lors/lib/course-structure.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/lib/course-structure.adp,v diff -u -r1.9 -r1.10 --- openacs-4/packages/lors/lib/course-structure.adp 17 Nov 2008 13:35:01 -0000 1.9 +++ openacs-4/packages/lors/lib/course-structure.adp 3 Dec 2008 12:36:41 -0000 1.10 @@ -6,7 +6,8 @@ #lorsm.Course_Name# - @course_name;noquote@(@identifier@)#lorsm.Course_Versions#
+ + @course_name;noquote@(@identifier@)#lorsm.Course_Versions#
#lors.Rename_Course# Index: openacs-4/packages/lors/lib/course-structure.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/lib/course-structure.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/lors/lib/course-structure.tcl 17 Nov 2008 13:35:01 -0000 1.13 +++ openacs-4/packages/lors/lib/course-structure.tcl 3 Dec 2008 12:36:42 -0000 1.14 @@ -18,19 +18,7 @@ set community_id [dotlrn_community::get_community_id] set return_url [ad_return_url] -ad_proc -public getFolderKey { - {-object_id:required} - } { - Gets the Folderkey for a file-storage folder_id - @option object_id Folder_id for file-storage folder - @author Ernie Ghiglione (ErnieG@mm.st) - - } { - return [db_string select_folder_key "select key - from fs_folders where object_id = :object_id"] - } - # set context & title set context [list "[_ lorsm.Course_Structure]"] set title "[_ lorsm.Course_Structure]" @@ -78,7 +66,7 @@ set creation_date [lc_time_fmt $creation_date "%x %X"] # Check for submanifests - if {[db_0or1row submans { }]} { + if {[db_0or1row submans {}]} { } else { set submanifests 0 } @@ -115,10 +103,7 @@ } template::multirow foreach organizations { - set total_items [db_string items_count \ - "select count(*) - from ims_cp_items i - where org_id=:org_id $exclude_where" -default 0] + set total_items [db_string items_count {} -default 0] # We get the indent of the items in this org_id set indent_list [lorsm::get_items_indent -org_id $org_id -exclude $exclude] template::util::list_of_lists_to_array $indent_list indent_array @@ -132,9 +117,7 @@ if {$type eq "webcontent" && ![string equal $identifierref {}]} { set href "[apm_package_url_from_id_mem $fs_package_id]view/ - [db_string select_folder_key {select key from fs_folders - where folder_id = :folder_id}]/[lorsm::fix_url - -url $identifierref]" + [db_string select_folder_key {}]/[lorsm::fix_url -url $identifierref]" } else { set href "[lors::object_url \ -url admin \ Index: openacs-4/packages/lors/lib/course-structure.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/lib/course-structure.xql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/lors/lib/course-structure.xql 8 Oct 2008 13:01:05 -0000 1.7 +++ openacs-4/packages/lors/lib/course-structure.xql 3 Dec 2008 12:36:42 -0000 1.8 @@ -1,176 +1,139 @@ - - - select - cp.man_id, - cp.course_name, - cp.identifier, - text 'Yes' as hello, - case - when hasmetadata = 't' then 'Yes' - else 'No' - end as man_metadata, - case - when isscorm = 't' then 'Yes' - else 'No' - end as isscorm, - cp.fs_package_id, - case - when fs_package_id is null then 'f' - else 't' - end as lorsm_p, - cp.folder_id, - cp.isshared, - acs.creation_user, - acs.creation_date, - acs.context_id, - cpmc.isenabled, - pf.format_pretty_name, - cpmc.istrackable - from - ims_cp_manifests cp, acs_objects acs, ims_cp_manifest_class cpmc, lorsm_course_presentation_formats pf - where - cp.man_id = acs.object_id - and cp.man_id = :man_id - and cp.man_id = cpmc.man_id - and cpmc.lorsm_instance_id = :package_id - and cp.parent_man_id = 0 - and cp.course_presentation_format = pf.format_id - - + + + select cp.man_id, cp.course_name, cp.identifier, + text 'Yes' as hello, - - - select - count(revision_id) - from - cr_revisions - where - item_id = ( - select - item_id - from - cr_revisions - where - revision_id = :man_id - ) - - + case when hasmetadata = 't' then 'Yes' + else 'No' + end as man_metadata, - - - select - item_id - from - cr_items - where - name = :instance and - parent_id = :root_folder - - + case when isscorm = 't' then 'Yes' + else 'No' + end as isscorm, + cp.fs_package_id, - - - select - count(*) as submanifests - from - ims_cp_manifests - where - man_id = :man_id - and - parent_man_id = :man_id - - + case when fs_package_id is null then 'f' + else 't' + end as lorsm_p, + cp.folder_id, cp.isshared, acs.creation_user, acs.creation_date, + acs.context_id, cpmc.isenabled, pf.format_pretty_name, cpmc.istrackable + from ims_cp_manifests cp, acs_objects acs, ims_cp_manifest_class cpmc, + lorsm_course_presentation_formats pf + where cp.man_id = acs.object_id + and cp.man_id = :man_id + and cp.man_id = cpmc.man_id + and cpmc.lorsm_instance_id = :package_id + and cp.parent_man_id = 0 + and cp.course_presentation_format = pf.format_id + + - - - select - org.org_id, - org.org_title as org_title, - org.hasmetadata, - tree_level(o.tree_sortkey) as indent - from - ims_cp_organizations org, acs_objects o - where - org.org_id = o.object_id - and - man_id = :man_id - order by - org_id - - + + + select count(revision_id) + from cr_revisions + where item_id = ( select item_id + from cr_revisions + where revision_id = :man_id ) + + - - - SELECT - '' as delete, + + + select item_id + from cr_items + where name = :instance + and parent_id = :root_folder + + + + + + select count(*) as submanifests + from ims_cp_manifests + where man_id = :man_id + and parent_man_id = :man_id + + + + + + + select org.org_id, + org.org_title as org_title, + org.hasmetadata, + tree_level(o.tree_sortkey) as indent + from ims_cp_organizations org, acs_objects o + where org.org_id = o.object_id + and man_id = :man_id + order by org_id + + + + + + select '' as delete, '' as up, '' as down, - - o.object_id, - repeat(' ', (tree_level(o.tree_sortkey) - :indent)* 3) as indent, - i.ims_item_id as item_id, + o.object_id, + repeat(' ', (tree_level(o.tree_sortkey) - :indent)* 3) as indent, + i.ims_item_id as item_id, i.item_title as item_title, - i.hasmetadata, - i.org_id, - case - when i.isshared = 'f' then ( - 'false' - ) - else 'true' + i.hasmetadata, i.org_id, + + case when i.isshared = 'f' then ('false') + else 'true' end as isshared, + r.href, r.identifier as res_identifier, - case - when i.identifierref <> '' then r.href - else '' + + case when i.identifierref <> '' then r.href + else '' end as identifierref, - case - when i.identifierref <> '' - then r.type - else '' + + case when i.identifierref <> '' + then r.type else '' end as type, - m.fs_package_id, - m.folder_id, - m.course_name - FROM - acs_objects o, ims_cp_items i, ims_cp_manifests m, - ims_cp_items_to_resources i2r,ims_cp_resources r left - join acs_object_types ot on r.type=ot.object_type - WHERE - o.object_type = 'ims_item_object' - AND - i.org_id = :org_id - AND - o.object_id = i.ims_item_id - AND r.res_id=i2r.res_id - AND i2r.ims_item_id=i.ims_item_id - AND - i.ims_item_id = ( - select - live_revision - from - cr_items - where - item_id = ( - select - item_id - from - cr_revisions - where - revision_id = i.ims_item_id - ) - ) - AND - m.man_id = :man_id - $exclude_where - ORDER BY - i.sort_order,o.tree_sortkey,o.object_id - - + m.fs_package_id, m.folder_id, m.course_name + from acs_objects o, ims_cp_items i, ims_cp_manifests m, + ims_cp_items_to_resources i2r, + ims_cp_resources r left join acs_object_types ot on r.type=ot.object_type + where o.object_type = 'ims_item_object' + and i.org_id = :org_id + and o.object_id = i.ims_item_id + and r.res_id=i2r.res_id + and i2r.ims_item_id=i.ims_item_id + and i.ims_item_id = ( select live_revision + from cr_items + where item_id = ( select item_id + from cr_revisions + where revision_id = i.ims_item_id ) ) + and m.man_id = :man_id + $exclude_where + order by i.sort_order,o.tree_sortkey,o.object_id + + - \ No newline at end of file + + + select count(*) + from ims_cp_items i + where org_id=:org_id $exclude_where + + + + + + select key + from fs_folders + where folder_id = :folder_id + + + + Index: openacs-4/packages/lors/lib/object-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/lib/object-new.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/lors/lib/object-new.tcl 17 Nov 2008 13:35:01 -0000 1.4 +++ openacs-4/packages/lors/lib/object-new.tcl 3 Dec 2008 12:36:42 -0000 1.5 @@ -11,12 +11,7 @@ set assessment_package_id [dotlrn_community::get_applet_package_id \ -community_id $dotlrn_package_id \ -applet_key dotlrn_assessment] - set options [db_list_of_lists get_assessments \ - "select o.title,a.assessment_id - from as_assessments a, cr_items i, acs_objects o - where o.object_id=a.assessment_id - and i.latest_revision=a.assessment_id - and o.package_id=:assessment_package_id"] + set options [db_list_of_lists get_assessments {}] } wiki { # get a list of all the wiki pages # find xowiki package @@ -67,23 +62,12 @@ # FIXME pretend we can only have one organization per course # this is fine since we are not supporting a user interface to # create more than one way to organize the items in one manifest - set org_id [db_string get_org_id \ - "select org_id - from ims_cp_organizations - where man_id=:man_id"] - set item_folder_id [db_string get_folder_id \ - "select parent_id - from cr_items - where latest_revision=:org_id"] + set org_id [db_string get_org_id {}] + set item_folder_id [db_string get_folder_id {} ] switch $add_type { assessment { # we want one lors item per section - set sections [db_list_of_lists get_sections \ - "select a.item_id as section_item_id,a.name,a.title - from cr_items ci, as_sectionsx a, as_assessment_section_map m - where m.assessment_id=:existing_object - and a.section_id=m.section_id - and ci.latest_revision=m.assessment_id"] + set sections [db_list_of_lists get_sections {}] foreach {section} $sections { foreach {section_item_id section_name section_title} \ @@ -93,22 +77,14 @@ # we'll just let an admin add the assessment as many times # as they like, if there a new sections they will get added - if {![db_0or1row section_exists \ - "select res_id - from ims_cp_resources - where identifier=:section_item_id - and man_id=:man_id"]} { + if {![db_0or1row section_exists {}]} { set res_id [lors::imscp::resource_add_from_object \ -man_id $man_id \ -object_id $section_item_id \ -folder_id $item_folder_id] } - if {![db_0or1row item_exists \ - "select ims_item_id as item_id - from ims_cp_items - where org_id=:org_id - and identifier='as_sections_' || :section_item_id"]} { + if {![db_0or1row item_exists {}]} { set item_id [lors::imscp::item_add_from_object \ -object_id $section_item_id \ -org_id $org_id \ @@ -132,22 +108,14 @@ set page [::Generic::CrItem instantiate \ -item_id $existing_object] $page instvar {title page_title} {name page_name} - if {![db_0or1row res_exists \ - "select res_id - from ims_cp_resources - where identifier=:existing_object - and man_id=:man_id"]} { + if {![db_0or1row res_exists {}]} { set res_id [lors::imscp::resource_add_from_object \ -man_id $man_id \ -object_id $existing_object \ -folder_id $item_folder_id] } - if {![db_0or1row item_exists \ - "select ims_item_id - from ims_cp_items - where org_id=:org_id - and identifier='::xowiki::Page_' || :existing_object"]} { + if {![db_0or1row item_exists_2 {}]} { set item_id [lors::imscp::item_add_from_object \ -object_id $existing_object \ -org_id $org_id \ Index: openacs-4/packages/lors/lib/object-new.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/lib/object-new.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors/lib/object-new.xql 3 Dec 2008 12:36:42 -0000 1.1 @@ -0,0 +1,76 @@ + + + + + + select o.title,a.assessment_id + from as_assessments a, cr_items i, acs_objects o + where o.object_id=a.assessment_id + and i.latest_revision=a.assessment_id + and o.package_id=:assessment_package_id + + + + + + select org_id + from ims_cp_organizations + where man_id=:man_id + + + + + + select parent_id + from cr_items + where latest_revision=:org_id + + + + + + select a.item_id as section_item_id,a.name,a.title + from cr_items ci, as_sectionsx a, as_assessment_section_map m + where m.assessment_id=:existing_object + and a.section_id=m.section_id + and ci.latest_revision=m.assessment_id + + + + + + select res_id + from ims_cp_resources + where identifier=:section_item_id + and man_id=:man_id + + + + + + select ims_item_id as item_id + from ims_cp_items + where org_id=:org_id + and identifier='as_sections_' || :section_item_id + + + + + + select res_id + from ims_cp_resources + where identifier=:existing_object + and man_id=:man_id + + + + + + select ims_item_id + from ims_cp_items + where org_id=:org_id + and identifier='::xowiki::Page_' || :existing_object + + + + 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 -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} Index: openacs-4/packages/lors/tcl/apm-callbacks-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/apm-callbacks-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors/tcl/apm-callbacks-procs.xql 3 Dec 2008 12:36:42 -0000 1.1 @@ -0,0 +1,171 @@ + + + + + + select * + from ims_cp_manifests_copy + + + + + + select name as cr_dir, parent_id + from cr_items + where item_id = :folder_id + + + + + + 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 + + + + + + update ims_cp_manifest_class_copy + set man_id = :new_man_revision_id + where man_id = :original_man_id + + + + + + 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 + + + + + + select * + from ims_cp_resources_copy + where man_id = :original_man_id + + + + + + 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 + + + + + + update ims_cp_items_to_resources_copy + set new_res_id = :new_res_revision_id + where res_id = :original_res_id + + + + + + update ims_cp_files_copy + set res_id = :new_res_revision_id + where res_id = :original_res_id + + + + + + 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 + + + + + + select * + from ims_cp_organizations_copy + where man_id = :original_man_id + + + + + + 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 + + + + + + select * + from ims_cp_items_copy + where org_id = :original_org_id + + + + + + 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 + + + + + + update ims_cp_items_to_resources_copy + set new_ims_item_id = :new_ims_revision_id + where item_id = :original_item_id + + + + + + 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 + + + + Index: openacs-4/packages/lors/tcl/lors-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-callback-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/lors/tcl/lors-callback-procs.tcl 17 Nov 2008 13:35:02 -0000 1.3 +++ openacs-4/packages/lors/tcl/lors-callback-procs.tcl 3 Dec 2008 12:36:42 -0000 1.4 @@ -33,14 +33,7 @@ ad_proc -callback application-track::getGeneralInfo -impl lorsm {} { callback implementation } { - db_1row my_query { - select count(1) as result - from ( - select distinct l.course_id - from lorsm_student_track l - where l.community_id=:comm_id - group by l.course_id) as t - } + db_1row my_query {} return "$result" } Index: openacs-4/packages/lors/tcl/lors-callback-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-callback-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors/tcl/lors-callback-procs.xql 3 Dec 2008 12:36:42 -0000 1.1 @@ -0,0 +1,15 @@ + + + + + + select count(1) as result + from ( + select distinct l.course_id + from lorsm_student_track l + where l.community_id=:comm_id + group by l.course_id) as t + + + + Index: openacs-4/packages/lors/tcl/lors-cr-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-cr-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/lors/tcl/lors-cr-procs.tcl 17 Nov 2008 13:35:02 -0000 1.7 +++ openacs-4/packages/lors/tcl/lors-cr-procs.tcl 3 Dec 2008 12:36:42 -0000 1.8 @@ -96,9 +96,7 @@ #return [list $name $folder_name $parent_id $user_id $creation_ip] # create the folder - set folder_id [db_exec_plsql folder_create { - select lors__new_folder (:name, :folder_name, :parent_id, :user_id, :creation_ip); - }] + set folder_id [db_exec_plsql folder_create {}] content::folder::register_content_type \ -folder_id $folder_id \ @@ -180,9 +178,7 @@ set file_size [cr_file_size $cr_file] # update the file path in the CR and the size on cr_revisions - db_dml update_revi \ - "update cr_revisions set content = '$cr_file', - content_length = $file_size where revision_id = :version_id" + db_dml update_revi {} lappend retlist [list $fle $mime_type $parent_id $file_id $version_id $cr_file $file_size] } @@ -200,6 +196,5 @@ set package_id [ad_conn package_id] set folder_id [fs_get_root_folder -package_id $package_id] } - return [db_exec_plsql get_item_id \ - "select content_item__get_id ( :name, :folder_id, 'f' )"] + return [db_exec_plsql get_item_id {}] } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/lors/tcl/lors-cr-procs.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/lors/tcl/lors-imscp-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-imscp-procs-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lors/tcl/lors-imscp-procs-postgresql.xql 26 Feb 2005 20:03:06 -0000 1.1 +++ openacs-4/packages/lors/tcl/lors-imscp-procs-postgresql.xql 3 Dec 2008 12:36:42 -0000 1.2 @@ -3,20 +3,12 @@ postgresql7.1 - - - select ims_manifest__new ( - :man_id, - :identifier, - :version, - :orgs_default, - :hasmetadata, - :parent_man_id, - current_timestamp, - :user_id, - :creation_ip, - :package_id - ) - - + + + select ims_manifest__new + ( :man_id, :identifier, :version, :orgs_default, :hasmetadata, + :parent_man_id, current_timestamp, :user_id, :creation_ip, + :package_id ) + + Index: openacs-4/packages/lors/tcl/lors-imscp-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-imscp-procs.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/lors/tcl/lors-imscp-procs.tcl 17 Nov 2008 13:35:03 -0000 1.18 +++ openacs-4/packages/lors/tcl/lors-imscp-procs.tcl 3 Dec 2008 12:36:42 -0000 1.19 @@ -275,13 +275,7 @@ } else { set item_id $version_id - set isshared [db_string get_isshared \ - "select im.isshared - from ims_cp_manifests im - where im.man_id = ( - select live_revision - from cr_items - where item_id = :version_id) "] + set isshared [db_string get_isshared {}] } set revision_id [content::revision::new \ @@ -296,27 +290,7 @@ # Now the new revision_id will be sent to the sql function with the # additional information as before - set manifest_id [db_exec_plsql new_manifest { - select ims_manifest__new ( - :course_name, - :identifier, - :version, - :orgs_default, - :hasmetadata, - :parent_man_id, - :isscorm, - :content_folder_id, - :fs_package_id, - current_timestamp, - :user_id, - :creation_ip, - :package_id, - :community_id, - :class_key, - :revision_id, - :isshared, - :course_presentation_format - );}] + set manifest_id [db_exec_plsql new_manifest {}] return $manifest_id } @@ -341,12 +315,7 @@ # remove file storage items - foreach file_item_id [db_list get_files \ - "select item_id - from cr_revisions cr, ims_cp_files f, ims_cp_resources r - where f.res_id=r.res_id - and r.man_id=:man_id - and cr.revision_id=f.file_id"] { + foreach file_item_id [db_list get_files {}] { # delete related file_storage files content::item::delete -item_id $file_item_id } @@ -355,19 +324,8 @@ # is removed (on delete cascade on res_id) # remove ims_cp_items - foreach item_id [db_list get_items \ - "select cr.item_id - from cr_revisions cr, ims_cp_items i, ims_cp_items_to_resources ir, ims_cp_resources r - where r.man_id=:man_id - and r.res_id=ir.res_id - and i.ims_item_id=ir.ims_item_id - and cr.revision_id=i.ims_item_id"] { - db_dml delete_map \ - "delete from ims_cp_items_map - where ims_item_id in - (select revision_id - from cr_revisions - where item_id=:item_id)" + foreach item_id [db_list get_items {}] { + db_dml delete_map {} # ad_return_complaint 1 "item_id $item_id ims_item_id $ims_item_id" content::item::delete -item_id $item_id } @@ -376,42 +334,27 @@ # ims_cp_items row is deleted (on delete cascade) # remove ims_cp_resources - foreach res_item_id [db_list get_res \ - "select item_id - from cr_revisions, ims_cp_resources - where revision_id=res_id - and man_id=:man_id"] { + foreach res_item_id [db_list get_res {}] { content::item::delete -item_id $res_item_id } # remove rows in lorsm_cmi_core - db_dml delete_cmi "delete from lorsm_cmi_core where man_id=:man_id" + db_dml delete_cmi {} # remove rows in lorsm_student_track - db_dml delete_track "delete from lorsm_student_track where course_id = :man_id" + db_dml delete_track {} # FIXME see if other lorms tables need to be cleaned out # remove ims_cp_organization - foreach org_item_id [db_list get_org \ - "select item_id - from cr_revisions, ims_cp_organizations - where revision_id=org_id - and man_id=:man_id"] { - - db_dml delete_map \ - "delete from ims_cp_items_map - where org_id in (select revision_id - from cr_revisions - where item_id=:org_item_id)" + foreach org_item_id [db_list get_org {}] { + db_dml delete_map_2 {} content::item::delete -item_id $org_item_id } # remove ims_cp_manifest_class # this deletes the association between the course and all dotlrn # classes where it was used - db_dml delete_manifest_class \ - "delete from ims_cp_manifest_class - where man_id=:man_id" + db_dml delete_manifest_class {} } set ret [content::item::delete \ -item_id [content::revision::item_id \ @@ -486,22 +429,7 @@ -item_id $item_id \ -is_live "t"] - set organization_id [db_exec_plsql new_organization { - select ims_organization__new ( - :org_id, - :man_id, - :identifier, - :structure, - :title, - :hasmetadata, - current_timestamp, - :user_id, - :creation_ip, - :package_id, - :revision_id - ); - - }] + set organization_id [db_exec_plsql new_organization {}] return $organization_id } @@ -514,8 +442,7 @@ @author Ernie Ghiglione (ErnieG@mm.st) } { - set ret [db_exec_plsql delete_organization { - select ims_organization__delete (:org_id);}] + set ret [db_exec_plsql delete_organization {}] return $ret } @@ -621,41 +548,11 @@ -item_id $cr_item_id \ -is_live "t"] - set item_id [db_exec_plsql new_item { - select ims_item__new ( - :item_id, - :org_id, - :identifier, - :identifierref, - :isvisible, - :parameters, - :title, - :parent_item, - :hasmetadata, - :prerequisites_t, - :prerequisites_s, - :type, - :maxtimeallowed, - :timelimitaction, - :datafromlms, - :masteryscore, - current_timestamp, - :user_id, - :creation_ip, - :package_id, - :revision_id - ); + set item_id [db_exec_plsql new_item {}] - }] + set next_sort_order [db_string get_max {}] - set next_sort_order [db_string get_max \ - "select coalesce(max(sort_order)+1,1) - from ims_cp_items - where org_id=:org_id"] - db_dml set_sort_order \ - "update ims_cp_items - set sort_order = :next_sort_order - where ims_item_id = :item_id" + db_dml set_sort_order {} if {![empty_string_p $dotlrn_permission]} { permission::toggle_inherit -object_id $item_id @@ -703,11 +600,7 @@ db_transaction { content::item::delete \ -item_id [content::revision::item_id -revision_id $item_id] - set ret [db_exec_plsql delete_item { - select ims_item__delete ( - :item_id - ); - }] + set ret [db_exec_plsql delete_item {}] } return $ret } @@ -859,23 +752,7 @@ -item_id $item_id \ -is_live "t"] - set resource_id [db_exec_plsql new_resource { - select ims_resource__new ( - :res_id, - :man_id, - :identifier, - :type, - :href, - :scorm_type, - :hasmetadata, - current_timestamp, - :user_id, - :creation_ip, - :package_id, - :revision_id - ); - - }] + set resource_id [db_exec_plsql new_resource {}] return $resource_id } @@ -891,12 +768,7 @@ db_transaction { content::item::delete \ -item_id [content::revision::item_id -revision_id $res_id] - set ret [db_exec_plsql delete_resource { - select ims_resource__delete ( - :res_id - ); - - }] + set ret [db_exec_plsql delete_resource {}] } return $ret } @@ -913,13 +785,7 @@ @author Ernie Ghiglione (ErnieG@mm.st) } { # db_transaction { - set item_to_resource [db_exec_plsql item_to_resources_add { - select ims_cp_item_to_resource__new ( - :item_id, - :res_id - ); - } - ] + set item_to_resource [db_exec_plsql item_to_resources_add {}] # } return $item_to_resource } @@ -936,13 +802,7 @@ @author Ernie Ghiglione (ErnieG@mm.st) } { set dep_id [db_nextval ims_cp_dependencies_seq] - set dependency [db_exec_plsql dependency_add { - select ims_dependency__new ( - :dep_id, - :res_id, - :identifierref - ); - }] + set dependency [db_exec_plsql dependency_add {}] return $dep_id } @@ -955,12 +815,7 @@ @author Ernie Ghiglione (ErnieG@mm.st) } { - set ret [db_exec_plsql delete_resource { - select ims_dependency__delete ( - :dep_id - ); - - }] + set ret [db_exec_plsql delete_resource {}] return $ret } @@ -990,22 +845,10 @@ # catch that before we try to insert them again under the same # resource - set file_exists [db_0or1row file_ex \ - "select file_id - from ims_cp_files - where file_id = :file_id - and res_id = :res_id"] + set file_exists [db_0or1row file_ex {}] if {$file_exists == 0} { - set file [db_exec_plsql file_add { - select ims_file__new ( - :file_id, - :res_id, - :pathtofile, - :filename, - :hasmetadata - ); - }] + set file [db_exec_plsql file_add {}] } return $file_id } @@ -1233,10 +1076,7 @@ } # get the title from acs objects - db_1row get_object \ - "select object_type, title - from acs_objects - where object_id=:object_id" -column_array object + db_1row get_object {} -column_array object if {$title eq ""} { set title $object(title) @@ -1253,12 +1093,7 @@ -identifierref $object_id \ -parent_item $parent_item \ -title $title] - db_dml set_sort_order \ - "update ims_cp_items - set sort_order = (select coalesce(max(sort_order),0) - from ims_cp_items - where parent_item=:parent_item) + 1 - where ims_item_id=:item_id" + db_dml set_sort_order {} return $item_id } @@ -1285,10 +1120,7 @@ @error } { - db_1row get_object \ - "select object_type, title - from acs_objects - where object_id=:object_id" -column_array object + db_1row get_object {} -column_array object if {$object(object_type) eq "content_item"} { set object(object_type) [content::item::content_type -item_id $object_id] } Index: openacs-4/packages/lors/tcl/lors-imscp-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-imscp-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lors/tcl/lors-imscp-procs.xql 3 Sep 2008 15:18:19 -0000 1.2 +++ openacs-4/packages/lors/tcl/lors-imscp-procs.xql 3 Dec 2008 12:36:42 -0000 1.3 @@ -1,12 +1,239 @@ - - - select r.identifier - from ims_cp_resources r, ims_cp_items_to_resources i - where i.ims_item_id = :ims_item_id - and r.res_id = i.res_id - - - \ No newline at end of file + + + + select r.identifier + from ims_cp_resources r, ims_cp_items_to_resources i + where i.ims_item_id = :ims_item_id + and r.res_id = i.res_id + + + + + + select im.isshared + from ims_cp_manifests im + where im.man_id = ( select live_revision + from cr_items + where item_id = :version_id ) + + + + + + select ims_manifest__new + ( :course_name, :identifier, :version, :orgs_default, :hasmetadata, + :parent_man_id, :isscorm, :content_folder_id, :fs_package_id, + current_timestamp, :user_id, :creation_ip, :package_id, + :community_id, :class_key, :revision_id, :isshared, + :course_presentation_format ) + + + + + + select ims_organization__new + ( :org_id, :man_id, :identifier, :structure, :title, + :hasmetadata, current_timestamp, :user_id, :creation_ip, + :package_id, :revision_id ) + + + + + + select ims_organization__delete (:org_id) + + + + + + select item_id + from cr_revisions cr, ims_cp_files f, ims_cp_resources r + where f.res_id=r.res_id + and r.man_id=:man_id + and cr.revision_id=f.file_id + + + + + + select cr.item_id + from cr_revisions cr, ims_cp_items i, ims_cp_items_to_resources ir, ims_cp_resources r + where r.man_id=:man_id + and r.res_id=ir.res_id + and i.ims_item_id=ir.ims_item_id + and cr.revision_id=i.ims_item_id + + + + + + delete from ims_cp_items_map + where ims_item_id in (select revision_id + from cr_revisions + where item_id=:item_id) + + + + + + delete from ims_cp_items_map + where org_id in (select revision_id + from cr_revisions + where item_id=:org_item_id) + + + + + + delete + from ims_cp_manifest_class + where man_id=:man_id + + + + + + delete + from lorsm_cmi_core + where man_id=:man_id + + + + + + delete + from lorsm_student_track + where course_id = :man_id + + + + + + select item_id + from cr_revisions, ims_cp_organizations + where revision_id=org_id + and man_id=:man_id + + + + + + select item_id + from cr_revisions, ims_cp_resources + where revision_id=res_id + and man_id=:man_id + + + + + + + select ims_item__new + ( :item_id, :org_id, :identifier, :identifierref, + :isvisible, :parameters, :title, :parent_item, :hasmetadata, + :prerequisites_t, :prerequisites_s, :type, :maxtimeallowed, + :timelimitaction, :datafromlms, :masteryscore, current_timestamp, + :user_id, :creation_ip, :package_id, :revision_id ) + + + + + + select coalesce(max(sort_order)+1,1) + from ims_cp_items + where org_id=:org_id + + + + + + update ims_cp_items + set sort_order = :next_sort_order + where ims_item_id = :item_id + + + + + + select ims_item__delete (:item_id) + + + + + + select ims_resource__new + ( :res_id, :man_id, :identifier, :type, :href, :scorm_type, + :hasmetadata, current_timestamp, :user_id, :creation_ip, + :package_id, :revision_id ) + + + + + + select ims_resource__delete (:res_id) + + + + + + select ims_cp_item_to_resource__new (:item_id, :res_id) + + + + + + select ims_dependency__new (:dep_id, :res_id, :identifierref ) + + + + + + select ims_dependency__delete (:dep_id) + + + + + + select file_id + from ims_cp_files + where file_id = :file_id + and res_id = :res_id + + + + + + select ims_file__new (:file_id, :res_id, :pathtofile, :filename, :hasmetadata) + + + + + + select object_type, title + from acs_objects + where object_id=:object_id + + + + + + update ims_cp_items + set sort_order = ( select coalesce(max(sort_order),0) + from ims_cp_items + where parent_item=:parent_item) + 1 + where ims_item_id=:item_id + + + + + + select object_type, title + from acs_objects + where object_id=:object_id + + + + Index: openacs-4/packages/lors/tcl/lors-imsmd-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-imsmd-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/lors/tcl/lors-imsmd-procs.tcl 17 Nov 2008 13:35:03 -0000 1.11 +++ openacs-4/packages/lors/tcl/lors-imsmd-procs.tcl 3 Dec 2008 12:36:42 -0000 1.12 @@ -1280,10 +1280,7 @@ -prefix $prefix] # Now we insert the values into the DB - db_dml add_new_general { - insert into ims_md_general (ims_md_id, structure_s, structure_v, agg_level_s, agg_level_v) - values (:p_ims_md_id, :structure_s, :structure_v, :agg_level_s, :agg_level_v) - } + db_dml add_new_general {} # Adds General Titles @@ -1293,10 +1290,7 @@ set p_title_l [lindex $title 0] set p_title_s [lindex $title 1] - db_dml add_new_general_titles { - insert into ims_md_general_title (ims_md_ge_ti_id, ims_md_id, title_l, title_s) - values (:p_ims_md_ge_ti_id, :p_ims_md_id, :p_title_l, :p_title_s) - } + db_dml add_new_general_titles {} } @@ -1307,20 +1301,14 @@ set p_entry_l [lindex [lindex $catalogentry 1] 0] set p_entry_s [lindex [lindex $catalogentry 1] 1] - db_dml add_new_general_catalogentries { - insert into ims_md_general_cata (ims_md_ge_cata_id, ims_md_id, catalog, entry_l, entry_s) - values (:p_ims_md_ge_cata_id, :p_ims_md_id, :p_catalog, :p_entry_l, :p_entry_s) - } + db_dml add_new_general_catalogentries {} } # Adds General Languages foreach language $languages { set p_ims_md_ge_lang_id [db_nextval ims_md_general_lang_seq] - db_dml add_new_general_language { - insert into ims_md_general_lang (ims_md_ge_lang_id, ims_md_id, language) - values (:p_ims_md_ge_lang_id, :p_ims_md_id, :language) - } + db_dml add_new_general_language {} } # Adds General Description @@ -1329,10 +1317,7 @@ set p_descrip_l [lindex $description 0] set p_descrip_s [lindex $description 1] - db_dml add_new_general_description { - insert into ims_md_general_desc (ims_md_ge_desc_id, ims_md_id, descrip_l, descrip_s) - values (:p_ims_md_ge_desc_id, :p_ims_md_id, :p_descrip_l, :p_descrip_s) - } + db_dml add_new_general_description {} } # Adds General Keywords @@ -1341,10 +1326,7 @@ set p_keyword_l [lindex $keyword 0] set p_keyword_s [lindex $keyword 1] - db_dml add_new_general_keyword { - insert into ims_md_general_key (ims_md_ge_key_id, ims_md_id, keyword_l, keyword_s) - values (:p_ims_md_ge_key_id, :p_ims_md_id, :p_keyword_l, :p_keyword_s) - } + db_dml add_new_general_keyword {} } # Adds General Coverage @@ -1353,10 +1335,7 @@ set p_cover_l [lindex $coverage 0] set p_cover_s [lindex $coverage 1] - db_dml add_new_general_coverage { - insert into ims_md_general_cover (ims_md_ge_cove_id, ims_md_id, cover_l, cover_s) - values (:p_ims_md_ge_cove_id, :p_ims_md_id, :p_cover_l, :p_cover_s) - } + db_dml add_new_general_coverage {} } # Lifecycle @@ -1384,10 +1363,7 @@ -prefix $prefix] # Adds Lifecycle Version and Status - db_dml add_new_lifecycle { - insert into ims_md_life_cycle (ims_md_id, version_l, version_s, status_s, status_v) - values (:p_ims_md_id, :version_l, :version_s, :status_s, :status_v) - } + db_dml add_new_lifecycle {} # Adds Lifecycle Contributes foreach contribute $contributes { @@ -1400,20 +1376,14 @@ set p_entities [lindex $contribute 1] - db_dml add_new_lifecycle_contrib { - insert into ims_md_life_cycle_contrib (ims_md_lf_cont_id, ims_md_id, role_s, role_v, cont_date, cont_date_l, cont_date_s) - values (:p_ims_md_lf_cont_id, :p_ims_md_id, :p_role_s, :p_role_v, :p_cont_date, :p_cont_date_l, :p_cont_date_s) - } + db_dml add_new_lifecycle_contrib {} foreach entity $p_entities { set p_ims_md_lf_cont_enti_id [db_nextval ims_md_life_cycle_contrib_entity_seq] set p_entity $entity - db_dml add_new_lifecycle_contrib_entity { - insert into ims_md_life_cycle_contrib_entity (ims_md_lf_cont_enti_id, ims_md_lf_cont_id, entity) - values (:p_ims_md_lf_cont_enti_id, :p_ims_md_lf_cont_id, :p_entity) - } + db_dml add_new_lifecycle_contrib_entity {} } } @@ -1444,10 +1414,7 @@ -prefix $prefix] # Adds Metadata Language - db_dml add_new_metadata { - insert into ims_md_metadata (ims_md_id, language) - values (:p_ims_md_id, :p_language) - } + db_dml add_new_metadata {} # Adds Catalogentry foreach catalogentry $catalogentries { @@ -1456,10 +1423,7 @@ set p_entry_l [lindex [lindex $catalogentry 1] 0] set p_entry_s [lindex [lindex $catalogentry 1] 1] - db_dml add_new_metadata_catalogentries { - insert into ims_md_metadata_cata (ims_md_md_cata_id, ims_md_id, catalog, entry_l, entry_s) - values (:p_ims_md_md_cata_id, :p_ims_md_id, :p_catalog, :p_entry_l, :p_entry_s) - } + db_dml add_new_metadata_catalogentries {} } # Adds Lifecycle Contributes @@ -1474,26 +1438,17 @@ set p_ims_md_md_cont_enti_id [db_nextval ims_md_metadata_contrib_entity_seq] set p_entity [lindex [lindex $contribute 1] 0] - db_dml add_new_metadata_contrib { - insert into ims_md_metadata_contrib (ims_md_md_cont_id, ims_md_id, role_s, role_v, cont_date, cont_date_l, cont_date_s) - values (:p_ims_md_md_cont_id, :p_ims_md_id, :p_role_s, :p_role_v, :p_cont_date, :p_cont_date_l, :p_cont_date_s) - } + db_dml add_new_metadata_contrib {} - db_dml add_new_metadata_contrib_entity { - insert into ims_md_metadata_contrib_entity (ims_md_md_cont_enti_id, ims_md_md_cont_id, entity) - values (:p_ims_md_md_cont_enti_id, :p_ims_md_md_cont_id, :p_entity) - } + db_dml add_new_metadata_contrib_entity {} } # Adds Metadata Schemes foreach metadatascheme $metadataschemes { set p_ims_md_md_sch_id [db_nextval ims_md_metadata_scheme_seq] set p_scheme $metadatascheme - db_dml add_new_metadata_metadatascheme { - insert into ims_md_metadata_scheme (ims_md_md_sch_id, ims_md_id, scheme) - values (:p_ims_md_md_sch_id, :p_ims_md_id, :p_scheme) - } + db_dml add_new_metadata_metadatascheme {} } # Technical @@ -1545,21 +1500,15 @@ -prefix $prefix] # Adds Technical size, installation remarks, otherplatformrequirements, duration - db_dml add_new_technical { - insert into ims_md_technical (ims_md_id, t_size, instl_rmrks_l, instl_rmrks_s, otr_plt_l, otr_plt_s, duration, duration_l, duration_s) - values (:p_ims_md_id, :p_size, :p_instl_rmks_l, :p_instl_rmks_s, :p_otr_plt_l, :p_otr_plt_s, :p_duration, :p_duration_l, :p_duration_s) - } + db_dml add_new_technical {} # Adds Technical Format foreach format $formats { set p_ims_md_te_fo_id [db_nextval ims_md_technical_format_seq] set p_format $format - db_dml add_new_technical_format { - insert into ims_md_technical_format (ims_md_te_fo_id, ims_md_id, format) - values (:p_ims_md_te_fo_id, :p_ims_md_id, :p_format) - } + db_dml add_new_technical_format {} } # Adds Technical Location @@ -1569,10 +1518,7 @@ set p_type [lindex $location 1] set p_location [lindex $location 0] - db_dml add_new_technical_location { - insert into ims_md_technical_location (ims_md_te_lo_id, ims_md_id, type, location) - values (:p_ims_md_te_lo_id, :p_ims_md_id, :p_type, :p_location) - } + db_dml add_new_technical_location {} } # Adds Technical Requirements @@ -1586,10 +1532,7 @@ set p_min_version [lindex $requirement 2] set p_max_version [lindex $requirement 3] - db_dml add_new_technical_requirement { - insert into ims_md_technical_requirement (ims_md_te_rq_id, ims_md_id, type_s, type_v, name_s, name_v, min_version, max_version) - values (:p_ims_md_te_rq_id, :p_ims_md_id, :p_type_s, :p_type_v, :p_name_s, :p_name_v, :p_min_version, :p_max_version) - } + db_dml add_new_technical_requirement {} } # Educational @@ -1668,21 +1611,15 @@ # Adds Educational interactivitytype, interactivitylevel, semanticdensity, difficulty, typical_learning_time - db_dml add_new_educational { - insert into ims_md_educational (ims_md_id, int_type_s, int_type_v, int_level_s, int_level_v, sem_density_s, sem_density_v, difficulty_s, difficulty_v, type_lrn_time, type_lrn_time_l, type_lrn_time_s) - values (:p_ims_md_id, :p_int_type_s, :p_int_type_v, :p_int_level_s, :p_int_level_v, :p_sem_density_s, :p_sem_density_v, :p_difficulty_s, :p_difficulty_v, :p_type_lrn_time, :p_type_lrn_time_l, :p_type_lrn_time_s) - } + db_dml add_new_educational {} # Adds descriptions foreach descrip $descrips { set p_ims_md_ed_de_id [db_nextval ims_md_educational_descrip_seq] set p_descrip_l [lindex $descrip 0] set p_descrip_s [lindex $descrip 1] - db_dml add_new_descriptions { - insert into ims_md_educational_descrip (ims_md_ed_de_id, ims_md_id, descrip_l, descrip_s) - values (:p_ims_md_ed_de_id, :p_ims_md_id, :p_descrip_l, :p_descrip_s) - } + db_dml add_new_descriptions {} } # Adds learningresourcetype @@ -1691,10 +1628,7 @@ set p_lrt_s [lindex [lindex $lrt 0] 1] set p_lrt_v [lindex [lindex $lrt 1] 1] - db_dml add_new_learningresourcetypes { - insert into ims_md_educational_lrt (ims_md_ed_lr_id, ims_md_id, lrt_s, lrt_v) - values (:p_ims_md_ed_lr_id, :p_ims_md_id, :p_lrt_s, :p_lrt_v) - } + db_dml add_new_learningresourcetypes {} } # Adds intendedenduserrole @@ -1703,10 +1637,7 @@ set p_ieur_s [lindex [lindex $ieur 0] 1] set p_ieur_v [lindex [lindex $ieur 1] 1] - db_dml add_new_intendedenduserroles { - insert into ims_md_educational_ieur (ims_md_ed_ie_id, ims_md_id, ieur_s, ieur_v) - values (:p_ims_md_ed_ie_id, :p_ims_md_id, :p_ieur_s, :p_ieur_v) - } + db_dml add_new_intendedenduserroles {} } # Adds context @@ -1715,10 +1646,7 @@ set p_context_s [lindex [lindex $context 0] 1] set p_context_v [lindex [lindex $context 1] 1] - db_dml add_new_context { - insert into ims_md_educational_context (ims_md_ed_co_id, ims_md_id, context_s, context_v) - values (:p_ims_md_ed_co_id, :p_ims_md_id, :p_context_s, :p_context_v) - } + db_dml add_new_context {} } # Adds typicalagerange @@ -1727,21 +1655,15 @@ set p_tar_l [lindex $tar 0] set p_tar_s [lindex $tar 1] - db_dml add_new_typicalagerange { - insert into ims_md_educational_tar (ims_md_ed_ta_id, ims_md_id, tar_l, tar_s) - values (:p_ims_md_ed_ta_id, :p_ims_md_id, :p_tar_l, :p_tar_s) - } + db_dml add_new_typicalagerange {} } # Adds Languages foreach lang $languages { set p_ims_md_ed_la_id [db_nextval ims_md_educational_lang_seq] set p_language $lang - db_dml add_new_language { - insert into ims_md_educational_lang (ims_md_ed_la_id, ims_md_id, language) - values (:p_ims_md_ed_la_id, :p_ims_md_id, :p_language) - } + db_dml add_new_language {} } # Rights @@ -1770,10 +1692,7 @@ set p_descrip_l [lindex [lindex $p_descrip 0] 0] set p_descrip_s [lindex [lindex $p_descrip 0] 1] - db_dml add_new_rights { - insert into ims_md_rights (ims_md_id, cost_s, cost_v, caor_s, caor_v, descrip_l, descrip_s) - values (:p_ims_md_id, :p_cost_s, :p_cost_v, :p_caor_s, :p_caor_v, :p_descrip_l, :p_descrip_s) - } + db_dml add_new_rights {} # Relation @@ -1787,20 +1706,14 @@ set p_kind_v [lindex [lindex [lindex [lindex $relation 0] 0] 1] 1] # Adds kind - db_dml add_new_relation { - insert into ims_md_relation (ims_md_re_id, ims_md_id, kind_s, kind_v) - values (:p_ims_md_re_id, :p_ims_md_id, :p_kind_s, :p_kind_v) - } + db_dml add_new_relation {} set p_ims_md_re_re_id [db_nextval ims_md_relation_resource_seq] set p_descrip_l [lindex [lindex [lindex $relation 1] 0] 0] set p_descrip_s [lindex [lindex [lindex $relation 1] 0] 1] # adds description to resource - db_dml add_new_relation_descrip { - insert into ims_md_relation_resource (ims_md_re_re_id, ims_md_re_id, identifier, descrip_l, descrip_s) - values (:p_ims_md_re_re_id, :p_ims_md_re_id, null, :p_descrip_l, :p_descrip_s) - } + db_dml add_new_relation_descrip {} # catalogentries set catalogentries [lindex $relation 2] @@ -1812,11 +1725,7 @@ set p_entry_l [lindex [lindex $catalogentry 1] 0] set p_entry_s [lindex [lindex $catalogentry 1] 1] - db_dml add_new_catalogentry { - - insert into ims_md_relation_resource_catalog (ims_md_re_re_ca_id, ims_md_re_re_id, catalog, entry_l, entry_s) - values(:p_ims_md_re_re_ca_id, :p_ims_md_re_re_id, :p_catalog, :p_entry_l, :p_entry_s) - } + db_dml add_new_catalogentry {} } } @@ -1833,20 +1742,14 @@ set p_descriptions [lindex $annotation 2] - db_dml add_new_annotation { - insert into ims_md_annotation (ims_md_an_id, ims_md_id, entity, date, date_l, date_s) - values (:p_ims_md_an_id, :p_ims_md_id, :p_entity, :p_date, :p_date_l, :p_date_s) - } + db_dml add_new_annotation {} foreach description $p_descriptions { set p_ims_md_an_de_id [db_nextval ims_md_annotation_descrip_seq] set p_descrip_l [lindex $description 0] set p_descrip_s [lindex $description 1] - db_dml add_new_ann_descriptions { - insert into ims_md_annotation_descrip (ims_md_an_de_id, ims_md_an_id, descrip_l, descrip_s) - values (:p_ims_md_an_de_id, :p_ims_md_an_id, :p_descrip_l, :p_descrip_s) - } + db_dml add_new_ann_descriptions {} } } @@ -1868,10 +1771,7 @@ [lindex \ [lindex $class 0] 0] 0] 1] 1] - db_dml add_new_classification { - insert into ims_md_classification (ims_md_cl_id, ims_md_id, purpose_s, purpose_v) - values (:p_ims_md_cl_id, :p_ims_md_id, :p_purpose_s, :p_purpose_v) - } + db_dml add_new_classification {} # description set descriptions [lindex [lindex $class 0] 1] @@ -1881,10 +1781,7 @@ set p_descrip_l [lindex $desc 0] set p_descrip_s [lindex $desc 1] - db_dml add_new_description { - insert into ims_md_classification_descrip (ims_md_cl_de_id, ims_md_cl_id, descrip_l, descrip_s) - values (:p_ims_md_cl_de_id, :p_ims_md_cl_id, :p_descrip_l, :p_descrip_s) - } + db_dml add_new_description {} } # taxonpath @@ -1899,10 +1796,7 @@ set taxons [lindex $taxonpath 1] - db_dml add_new_taxonpaths { - insert into ims_md_classification_taxpath (ims_md_cl_ta_id, ims_md_cl_id, source_l, source_v) - values (:p_ims_md_cl_ta_id, :p_ims_md_cl_id, :p_source_l, :p_source_s) - } + db_dml add_new_taxonpaths {} foreach taxon $taxons { set p_ims_md_cl_ta_ta_id [db_nextval ims_md_classification_taxpath_taxon_seq] @@ -1911,10 +1805,7 @@ set p_entry_l [lindex [lindex $taxon 2] 0] set p_entry_s [lindex [lindex $taxon 2] 1] - db_dml add_new_taxons { - insert into ims_md_classification_taxpath_taxon (ims_md_cl_ta_ta_id, ims_md_cl_ta_id, hierarchy, identifier, entry_l, entry_s) - values (:p_ims_md_cl_ta_ta_id, :p_ims_md_cl_ta_id, :p_hierarchy, :p_identifier, :p_entry_l, :p_entry_s) - } + db_dml add_new_taxons {} } } @@ -1926,10 +1817,7 @@ set p_keyword_l [lindex $keyword 0] set p_keyword_s [lindex $keyword 1] - db_dml add_new_keywords { - insert into ims_md_classification_keyword (ims_md_cl_ke_id, ims_md_cl_id, keyword_l, keyword_s) - values (:p_ims_md_cl_ke_id, :p_ims_md_cl_id, :p_keyword_l, :p_keyword_s) - } + db_dml add_new_keywords {} } } } @@ -2003,10 +1891,7 @@ # real point on doing so. lors::imsmd::delMD -acs_object $p_ims_md_id - db_dml add_md { - insert into ims_md (ims_md_id, schema, schemaversion) - values (:p_ims_md_id, :p_schema, :p_schemaversion) - } + db_dml add_md {} } @@ -2023,9 +1908,7 @@ # if record exists... if {[db_0or1row check_md_record {select ims_md_id from ims_md where ims_md_id = :p_ims_md_id}]} { # ... then delete it - db_dml add_md { - delete from ims_md where ims_md_id = :p_ims_md_id - } + db_dml add_md {} } } @@ -2042,7 +1925,7 @@ set p_ims_md_id $ims_md_id # if record exists... returns 1 - return [db_0or1row check_md_record {select ims_md_id from ims_md where ims_md_id = :p_ims_md_id}] + return [db_0or1row check_md_record {}] } } @@ -2145,6 +2028,7 @@ } + ad_proc -public md { {-owner:required} {-schema:required} Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/lors/tcl/lors-imsmd-procs.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/lors/tcl/lors-imsmd-sc-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-imsmd-sc-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/lors/tcl/lors-imsmd-sc-procs.tcl 17 Nov 2008 13:35:04 -0000 1.4 +++ openacs-4/packages/lors/tcl/lors-imsmd-sc-procs.tcl 3 Dec 2008 12:36:42 -0000 1.5 @@ -29,10 +29,7 @@ # languages. We get them all here. set titles "" - db_foreach title { - select title_l, title_s - from ims_md_general_title - where ims_md_id = :ims_md_id} { + db_foreach title {} { if {![empty_string_p $title_l]} { append titles "$title_s ($title_l) " @@ -47,10 +44,7 @@ set descriptions "" - db_foreach description { - select descrip_l, descrip_s - from ims_md_general_desc - where ims_md_id = :ims_md_id} { + db_foreach description {} { if {![empty_string_p $descrip_l]} { append descriptions "$descrip_s ($descrip_l) " @@ -67,10 +61,7 @@ # LOM General Keywords set keywords "" - db_foreach keyword { - select keyword_l, keyword_s - from ims_md_general_key - where ims_md_id = :ims_md_id} { + db_foreach keyword {} { if {![empty_string_p $keyword_l]} { append keywords "$keyword_s ($keyword_l) " } else { Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/lors/tcl/lors-imsmd-sc-procs.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/lors/tcl/lors-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/lors/tcl/lors-procs.tcl 17 Nov 2008 13:35:04 -0000 1.11 +++ openacs-4/packages/lors/tcl/lors-procs.tcl 3 Dec 2008 12:36:42 -0000 1.12 @@ -43,12 +43,7 @@ # page anchor set assessment_id "" set sort_order "" - db_0or1row get_assessment_id \ - "select ci.item_id as assessment_id, sort_order - from cr_items ci, cr_revisions cr, as_assessment_section_map m - where cr.item_id=:object_id - and cr.revision_id=m.section_id - and ci.latest_revision=assessment_id" + db_0or1row get_assessment_id {} return [export_vars \ -base questions \ Index: openacs-4/packages/lors/tcl/lors-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-procs.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lors/tcl/lors-procs.xql 6 Apr 2007 19:28:17 -0000 1.1 +++ openacs-4/packages/lors/tcl/lors-procs.xql 3 Dec 2008 12:36:42 -0000 1.2 @@ -2,47 +2,39 @@ - - - SELECT - i.item_title as item_title, - i.ims_item_id as item_id - FROM - acs_objects o, ims_cp_items i, ims_cp_manifests m, - ims_cp_organizations io, - ims_cp_items_to_resources i2r,ims_cp_resources r left - join acs_object_types ot on r.type=ot.object_type - WHERE - o.object_type = 'ims_item_object' - AND - i.org_id = io.org_id - AND io.man_id = m.man_id - AND - o.object_id = i.ims_item_id - AND r.res_id=i2r.res_id - AND i2r.ims_item_id=i.ims_item_id - AND - i.ims_item_id = ( - select - live_revision - from - cr_items - where - item_id = ( - select - item_id - from - cr_revisions - where - revision_id = i.ims_item_id - ) - ) - AND - m.man_id = :man_id - ORDER BY - i.sort_order,o.tree_sortkey,o.object_id + + + select ci.item_id as assessment_id, sort_order + from cr_items ci, cr_revisions cr, as_assessment_section_map m + where cr.item_id=:object_id + and cr.revision_id=m.section_id + and ci.latest_revision=assessment_id + + - - - \ No newline at end of file + + + select i.item_title as item_title, + i.ims_item_id as item_id + from acs_objects o, ims_cp_items i, ims_cp_manifests m, + ims_cp_organizations io, + ims_cp_items_to_resources i2r,ims_cp_resources r + left join acs_object_types ot on r.type=ot.object_type + where o.object_type = 'ims_item_object' + and i.org_id = io.org_id + and io.man_id = m.man_id + and o.object_id = i.ims_item_id + and r.res_id=i2r.res_id + and i2r.ims_item_id=i.ims_item_id + and i.ims_item_id = (select live_revision + from cr_items + where item_id = ( select item_id + from cr_revisions + where revision_id = i.ims_item_id ) ) + and m.man_id = :man_id + order by i.sort_order,o.tree_sortkey,o.object_id + + + + Index: openacs-4/packages/lors/tcl/lors-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-test-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/lors/tcl/lors-test-procs.tcl 17 Nov 2008 13:35:04 -0000 1.3 +++ openacs-4/packages/lors/tcl/lors-test-procs.tcl 3 Dec 2008 12:36:42 -0000 1.4 @@ -28,96 +28,21 @@ set fs_package_id "" # get package_id - set __package_id [db_string get_package \ - "select package_id - from apm_packages - where package_key='lorsm' limit 1"] + set __package_id [db_string get_package {}] # get community_id # create a new manifest set man_id \ - [db_exec_plsql man { - select ims_manifest__new( - null, - '__test_course__', - '__identifier__', - '__version__', - '__orgs_default__', - false, - null, - false, -- is scorm, test true? - :folder_id, - :fs_package_id, - now(), - null, - null, - :__package_id, - null, --community_id - null, --class_key - null) --presentation_format - }] + [db_exec_plsql man {}] # create organization - set org_id \ - [db_exec_plsql org { - select ims_organization__new ( - null, -- org_id, - :man_id, - '__identifier__', - '__structure__', - '__title__', - false, -- hasmetadata, - now(), - null, - null, - :__package_id - ) - }] + set org_id [db_exec_plsql org {}] # create some resources - set res_id \ - [db_exec_plsql res { - select ims_resource__new ( - null, - :man_id, - '__indentifier__', - '__type__', - '__href__', - '__scorm_type__', - false, --hasmetadata - now(), - null, - null, - :__package_id - ) - }] + set res_id [db_exec_plsql res {}] # create some items - set item_id \ - [db_exec_plsql item { - select ims_item__new ( - null, - :org_id, - '__identifier__', - '__identifier_href__', - true, - '__parameters__', - '__title__', - null, --parent_item - false, --hasmetadata - '__prereq_t__', - '__prereq_s__', - '__type__', - '__maxtimeallowed__', - '__timelimitaction__', - '__datafromlms__', - '__masteryscore__', - now(), - null, - null, - :__package_id - ) - }] + set item_id [db_exec_plsql item {}] # create some files set file_id \ @@ -129,20 +54,10 @@ [list title "__title__"]] \ content_item new] - db_exec_plsql file { - select ims_file__new ( - :file_id, - :res_id, - '__path_to_filename__', - '__filename__', - false --hasmetadata - ) - } + db_exec_plsql file {} # create item_to_resource mapping - db_dml i_to_r \ - "insert into ims_cp_items_to_resources (item_id,res_id) - values (:item_id,:res_id)" + db_dml i_to_r {} # create student_tracking @@ -153,8 +68,5 @@ # try to delete the whole couse lors::imscp::manifest_delete -man_id $man_id -delete_all t } - aa_false "Manifest $man_id deleted" [db_0or1row get_man \ - "select man_id - from ims_cp_manifests - where man_id=:man_id"] + aa_false "Manifest $man_id deleted" [db_0or1row get_man {}] } Index: openacs-4/packages/lors/tcl/lors-test-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-test-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors/tcl/lors-test-procs.xql 3 Dec 2008 12:36:42 -0000 1.1 @@ -0,0 +1,126 @@ + + + + + + select package_id + from apm_packages + where package_key='lorsm' + limit 1 + + + + + + select ims_manifest__new ( + null, + '__test_course__', + '__identifier__', + '__version__', + '__orgs_default__', + false, + null, + false, -- is scorm, test true? + :folder_id, + :fs_package_id, + now(), + null, + null, + :__package_id, + null, --community_id + null, --class_key + null) --presentation_format + + + + + + select ims_organization__new ( + null, -- org_id, + :man_id, + '__identifier__', + '__structure__', + '__title__', + false, -- hasmetadata, + now(), + null, + null, + :__package_id + ) + + + + + + select ims_resource__new ( + null, + :man_id, + '__indentifier__', + '__type__', + '__href__', + '__scorm_type__', + false, --hasmetadata + now(), + null, + null, + :__package_id + ) + + + + + + select ims_item__new ( + null, + :org_id, + '__identifier__', + '__identifier_href__', + true, + '__parameters__', + '__title__', + null, --parent_item + false, --hasmetadata + '__prereq_t__', + '__prereq_s__', + '__type__', + '__maxtimeallowed__', + '__timelimitaction__', + '__datafromlms__', + '__masteryscore__', + now(), + null, + null, + :__package_id + ) + + + + + + select ims_file__new ( + :file_id, + :res_id, + '__path_to_filename__', + '__filename__', + false --hasmetadata + ) + + + + + + insert into ims_cp_items_to_resources (item_id,res_id) + values (:item_id,:res_id) + + + + + + select man_id + from ims_cp_manifests + where man_id=:man_id + + + + +