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.4.2.1 -r1.4.2.2 --- openacs-4/packages/lors/tcl/lors-cr-procs.tcl 5 May 2006 17:23:14 -0000 1.4.2.1 +++ openacs-4/packages/lors/tcl/lors-cr-procs.tcl 7 Jun 2006 13:50:59 -0000 1.4.2.2 @@ -102,7 +102,17 @@ set folder_id [db_exec_plsql folder_create { select lors__new_folder (:name, :folder_name, :parent_id, :user_id, :creation_ip); }] - + + content::folder::register_content_type -folder_id $folder_id -content_type "content_revision" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_folder" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_symlink" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_extlink" \ + -include_subtypes "t" + + # } on_error { # ad_return_error "[_ lors.lt_Error_inserting_folde]" "[_ lors.The_error_was_errmsg]" # error "[_ lors.The_error_was_errmsg]" 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.7.2.2 -r1.7.2.3 --- openacs-4/packages/lors/tcl/lors-imscp-procs.tcl 5 May 2006 17:23:14 -0000 1.7.2.2 +++ openacs-4/packages/lors/tcl/lors-imscp-procs.tcl 7 Jun 2006 13:50:59 -0000 1.7.2.3 @@ -384,7 +384,7 @@ {-identifier ""} {-structure ""} {-title ""} - {-hasmetadata ""} + {-hasmetadata "f"} {-package_id ""} {-user_id ""} {-creation_ip ""} @@ -484,7 +484,7 @@ {-parameters ""} {-title ""} {-parent_item ""} - {-hasmetadata ""} + {-hasmetadata "f"} {-prerequisites_t ""} {-prerequisites_s ""} {-type ""} @@ -738,7 +738,7 @@ {-type ""} {-href ""} {-scorm_type ""} - {-hasmetadata ""} + {-hasmetadata "f"} {-package_id ""} {-user_id ""} {-creation_ip ""} @@ -1143,3 +1143,83 @@ } } + +ad_proc -public lors::imscp::item_add_from_object { + -object_id + -org_id + -folder_id + {-parent_item ""} + {-title ""} +} { + Create an ims cp item from an existing acs_object + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2006-06-06 + + @param object_id + @param org_id + @param folder_id + @param parent_item + @param title + + @return ims_item_id + @error +} { + + if {$parent_item eq ""} { + set parent_item $org_id + } + # 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 + if {$title eq ""} { + set title $object(title) + } + set item_id [lors::imscp::item_add \ + -org_id $org_id \ + -itm_folder_id $folder_id \ + -identifier ${object(object_type)}_${object_id} \ + -identifierref $object_id \ + -parent_item $parent_item \ + -title $object(title)] + + return $item_id + +} + +ad_proc -public lors::imscp::resource_add_from_object { + -object_id + -man_id + -folder_id +} { + Create an ims_cp_resource from an acs_object + + TODO since resources can be used for any course, we don't + need to add a seperate resource for each time an object is + used. We should return the existing res_id we just don't do that yet. + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2006-06-06 + + @param object_id + + @param man_id + + @return res_id + + @error +} { + db_1row get_object "select object_type, title from acs_objects where object_id=:object_id" -column_array object + if {$object(object_type) eq "content_item"} { + set object(object_type) [content::item::content_type -item_id $object_id] + } + set res_id [lors::imscp::resource_add \ + -man_id $man_id \ + -res_folder_id $folder_id \ + -identifier $object_id \ + -type $object(object_type) \ + -href "/o/$object_id"] + + return $res_id +} + 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.1.2.1 -r1.1.2.2 --- openacs-4/packages/lors/tcl/lors-procs.tcl 5 May 2006 17:23:14 -0000 1.1.2.1 +++ openacs-4/packages/lors/tcl/lors-procs.tcl 7 Jun 2006 13:50:59 -0000 1.1.2.2 @@ -1 +1,63 @@ +# packages/lors/tcl/lors-procs.tcl + +ad_library { + + Helper procedures for LORS + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2006-06-06 + @cvs-id $Id$ +} + +namespace eval lors:: {} + +ad_proc -public lors::object_url { + -object_id + + {-url "view"} +} { + Generate a URL for an acs_object as a learning object + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2006-06-06 + + @param object_id + + @param url + + @return + + @error +} { + + #view is easy + set object_type [acs_object_type $object_id] + if {$object_type eq "content_item"} { + set object_type [content::item::content_type -item_id $object_id] + } + switch $url { + admin { + + switch $object_type { + as_sections { + # FIXME either 1) make this magically work + # or 2) find the assessment_id and use + # page anchor + return [export_vars \ + -base ../assessment/asm-admin/one-a \ + {{section_id $object_id}}] + } + "::xowiki::Page" { + return [export_vars \ + -base /wiki/edit \ + {{item_id $object_id}}] + } + } + + } + default { + return "/o/${object_id}" + } + + } +}