-
#lorsm.lt_The_uploaded_file_is_# #lorsm.lt_SCORM_complaint_packa# Index: openacs-4/packages/lors-central/www/course-add-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-add-3.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lors-central/www/course-add-3.tcl 31 May 2005 22:57:22 -0000 1.2 +++ openacs-4/packages/lors-central/www/course-add-3.tcl 22 Jan 2007 08:09:25 -0000 1.3 @@ -251,7 +251,8 @@ } else { set man_isscorm 0 } - + # use isscorm proc! + set man_isscorm [lors::imscp::isSCORM -node $manifest] if { ![empty_string_p $metadata] } { set man_hasmetadata 1 } else { Index: openacs-4/packages/lors-central/www/course-associate.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-associate.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lors-central/www/course-associate.tcl 31 May 2005 22:57:22 -0000 1.2 +++ openacs-4/packages/lors-central/www/course-associate.tcl 22 Jan 2007 08:09:25 -0000 1.3 @@ -23,6 +23,12 @@ set man_id [content::item::get_live_revision -item_id $item_id] foreach community_id $object_id { + + # We first have to make sure that we install the lorsm portlet. + if {![db_string lorsm_applet_p "" -default 0]} { + dotlrn_community::add_applet_to_community $community_id "dotlrn_lorsm" + } + # Here we associate the course with every community_id that was checked lors_central::add_relation -item_id $item_id -community_id $community_id -class_key $type @@ -41,8 +47,8 @@ if { [empty_string_p $return_url] } { - ad_progress_bar_end -url "course-dotlrn-assoc?item_id=$item_id" -} else { - ad_progress_bar_end -url $return_url + set return_url [export_vars -base one-course-associations {man_id}] } +ad_progress_bar_end -url $return_url + Index: openacs-4/packages/lors-central/www/course-associate.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-associate.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/course-associate.xql 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/course-associate.xql 22 Jan 2007 08:09:25 -0000 1.2 @@ -12,6 +12,19 @@ + + ++ select 1 + from dotlrn_community_applets, + dotlrn_applets + where dotlrn_community_applets.community_id = :community_id + and dotlrn_community_applets.active_p = 't' + and dotlrn_community_applets.applet_id = dotlrn_applets.applet_id + and dotlrn_applets.active_p = 't' + and dotlrn_applets.applet_key = 'dotlrn_lorsm' + +select Index: openacs-4/packages/lors-central/www/course-dotlrn-assoc.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-dotlrn-assoc.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/lors-central/www/course-dotlrn-assoc.xql 9 Jun 2005 21:03:16 -0000 1.3 +++ openacs-4/packages/lors-central/www/course-dotlrn-assoc.xql 22 Jan 2007 08:09:25 -0000 1.4 @@ -11,7 +11,10 @@ dc.pretty_name, dc.url from - dotlrn_class_instances_full dc, dotlrn_instructor_rels_full drf + dotlrn_class_instances_full dc + left join + dotlrn_instructor_rels_full drf + on drf.community_id = dc.class_instance_id where dc.class_instance_id not in ( @@ -43,7 +46,10 @@ dc.pretty_name, dc.url from - dotlrn_class_instances_full dc, dotlrn_instructor_rels_full drf + dotlrn_class_instances_full dc + left join + dotlrn_instructor_rels_full drf + on drf.community_id = dc.class_instance_id where dc.class_instance_id in ( @@ -72,7 +78,9 @@ dc.pretty_name, dc.url from - dotlrn_communities_full dc, dotlrn_member_rels_full dm + dotlrn_communities_full dc + left join dotlrn_member_rels_full dm + on dm.community_id = dc.community_id where dc.community_id not in ( @@ -102,8 +110,10 @@ dc.pretty_name, dc.url from - dotlrn_communities_full dc, dotlrn_member_rels_full dm - where + dotlrn_communities_full dc + left join dotlrn_member_rels_full dm + on dm.community_id = dc.community_id + where dc.community_id in ( select Index: openacs-4/packages/lors-central/www/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/index.vuh,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/index.vuh 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/index.vuh 22 Jan 2007 08:09:25 -0000 1.2 @@ -36,6 +36,12 @@ set href [lors_central::get_href -ims_item_id $ims_item_id] set path_list [split $href "/"] + +if { [llength $path_list] == 1 } { + # There is no subfolder, so path_list is the url_name + set subfolder_name "" + set url_name $path_list +} else { set char [string range $href 0 0] if { [string equal $char "/"] } { set subfolder_name [lindex $path_list 1] @@ -44,6 +50,7 @@ set subfolder_name [lindex $path_list 0] set url_name [lindex $path_list 1] } +} # Get the folder_id from the href and figure it out if we have to move another # folder down Index: openacs-4/packages/lors-central/www/new-file.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/new-file.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lors-central/www/new-file.tcl 31 May 2005 22:57:22 -0000 1.2 +++ openacs-4/packages/lors-central/www/new-file.tcl 22 Jan 2007 08:09:25 -0000 1.3 @@ -47,7 +47,8 @@ -res_id $res_id \ -mime_type $mime_type \ -man_id $man_id ] - + + file delete $tmp_filename } -after_submit { ad_returnredirect [export_vars -base "one-resource" {{res_id $new_res_rev_id}}] Index: openacs-4/packages/lors-central/www/new-learning-object.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/new-learning-object.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lors-central/www/new-learning-object.tcl 31 May 2005 22:57:22 -0000 1.2 +++ openacs-4/packages/lors-central/www/new-learning-object.tcl 22 Jan 2007 08:09:25 -0000 1.3 @@ -36,328 +36,325 @@ } {file_upload:text(file) {label "[_ lors-central.choose_the_file]"} - {help_text "[_ lors-central.help_text]"} + {help_text "[_ lors-central.help_text]"} } {zip_p:text(checkbox),optional - {label "[_ lors-central.zip_file]"} - {options {{"" 1}}} - {help_text "[_ lors-central.this_is_a]"} + {label "[_ lors-central.zip_file]"} + {options {{"" 1}}} + {help_text "[_ lors-central.this_is_a]"} } {man_id:text(hidden) - {value $man_id} + {value $man_id} } {org_id:text(hidden) - {value $org_id} + {value $org_id} } {sort_order:text(hidden) - {value $sort_order} + {value $sort_order} } {parent:text(hidden) - {value $parent} + {value $parent} } } -on_submit { if { ![empty_string_p $zip_p] } { - # It's a zip file so we need to make some things - # unzips the file - if { ![empty_string_p $file_upload] && - [ catch {set tmp_dir [lors::imscp::expand_file $file_upload ${file_upload.tmpfile} expand_$file_upload] } \ - errMsg] } { - ad_return_complaint 1 "[_ lorsm.lt_The_uploaded_file_doe]" - ad_script_abort - } - # Now that we have the zip expanded we will process the files - set allfiles [lors::imscp::dir_walk $tmp_dir] + # It's a zip file so we need to make some things + # unzips the file + if { ![empty_string_p $file_upload] && + [ catch {set tmp_dir [lors::imscp::expand_file $file_upload ${file_upload.tmpfile} expand_$file_upload] } \ + errMsg] } { + ad_return_complaint 1 "[_ lorsm.lt_The_uploaded_file_doe]" + ad_script_abort + } + # Now that we have the zip expanded we will process the files + set allfiles [lors::imscp::dir_walk $tmp_dir] - db_transaction { - if { [empty_string_p $sort_order] } { - set max_sort_order [db_string get_max_sort_order { } ] - set sort_order [expr $max_sort_order + 1] - } else { - incr sort_order - } + db_transaction { + if { [empty_string_p $sort_order] } { + set max_sort_order [db_string get_max_sort_order { } ] + set sort_order [expr $max_sort_order + 1] + } else { + incr sort_order + } - # First we need to create a new resource - # We need to know where the new resource should be - set res_root_folder_id [lors_central::get_root_resources_folder_id] - set res_folder_id [lors_central::folder_id_from_man_parent -man_id $man_id -parent_id $res_root_folder_id] - - # We are going to make the first file that is in the tmp folder the default one - set first_file [lindex $allfiles 0] - set first_file_split [split $first_file "/"] - set first_filename [lindex $first_file_split [expr [llength $first_file_split] - 1]] - - # We are going to check if the file_name already exists - set first_filename [lors_central::check_item_name -parent_id $res_folder_id -name $first_filename] - set new_res_item_id [content::item::new -name $first_filename -creation_user $user_id \ - -parent_id $res_folder_id -content_type "ims_resource_object"] - - set new_res_rev_id [content::revision::new -item_id $new_res_item_id -title $first_filename \ - -creation_user $user_id -is_live "t"] - - # Now we have to update the new row in the ims_cp_resources using this new resource (new_res_id) - # we need a new href - set new_href "$first_filename" - - db_dml update_new_res { - update - ims_cp_resources - set - man_id = :man_id, - identifier = :first_filename, - type = 'webcontent', - href = :new_href, - hasmetadata = 'f' - where - res_id = :new_res_rev_id - } + # First we need to create a new resource + # We need to know where the new resource should be + set res_root_folder_id [lors_central::get_root_resources_folder_id] + set res_folder_id [lors_central::folder_id_from_man_parent -man_id $man_id -parent_id $res_root_folder_id] + + # We are going to make the first file that is in the tmp folder the default one + set first_file [lindex $allfiles 0] + set first_file_split [split $first_file "/"] + set first_filename [lindex $first_file_split [expr [llength $first_file_split] - 1]] + + # We are going to check if the file_name already exists + set first_filename [lors_central::check_item_name -parent_id $res_folder_id -name $first_filename] + set new_res_item_id [content::item::new -name $first_filename -creation_user $user_id \ + -parent_id $res_folder_id -content_type "ims_resource_object"] + + set new_res_rev_id [content::revision::new -item_id $new_res_item_id -title $first_filename \ + -creation_user $user_id -is_live "t"] + + # Now we have to update the new row in the ims_cp_resources using this new resource (new_res_id) + # we need a new href + set new_href "$first_filename" + + db_dml update_new_res { + update + ims_cp_resources + set + man_id = :man_id, + identifier = :first_filename, + type = 'webcontent', + href = :new_href, + hasmetadata = 'f' + where + res_id = :new_res_rev_id + } - - # First we are going to create a new cr_item (file) for the new resource - # We need the folder_id of the course to store the new item - set course_name [lors_central::get_course_name -man_id $man_id] - set root_folder [lors_central::get_root_folder_id] - set folder_id [db_string get_folder_id { }] + + # First we are going to create a new cr_item (file) for the new resource + # We need the folder_id of the course to store the new item + set course_name [lors_central::get_course_name -man_id $man_id] + set root_folder [lors_central::get_root_folder_id] + set folder_id [db_string get_folder_id { }] - # Now we are going to store all files in the Content Repository and insert the rows on ims_cp_files - # Here we are going to create a new cr_item and revision for the files that exist on - # the zip - foreach tmp_filename $allfiles { - set split_file [split $tmp_filename "/"] - set filename [lindex $split_file [expr [llength $split_file] - 1]] - set mime_type [cr_filename_to_mime_type -create $filename] - set tmp_size [file size $tmp_filename] - - # We are going to create a new item. First we are going to check - # if the name already exists to generate a new one - set filename [lors_central::check_item_name -parent_id $folder_id -name $filename] - set new_file_item_id [content::item::new -name $filename -creation_user $user_id \ - -parent_id $folder_id] - set new_file_id [content::revision::new -item_id $new_file_item_id -title $filename \ - -creation_user $user_id -mime_type $mime_type -is_live "t"] - - # Now we store the content in the CR - set cr_file [cr_create_content_file $new_file_item_id $new_file_id $tmp_filename] - - # get the size - set file_size [cr_file_size $cr_file] - - # update the file path in the CR and the size on cr_revisions - db_dml update_revision { - update - cr_revisions - set - content = :cr_file, - content_length = :file_size - where - revision_id = :new_file_id - } + # Now we are going to store all files in the Content Repository and insert the rows on ims_cp_files + # Here we are going to create a new cr_item and revision for the files that exist on + # the zip + foreach tmp_filename $allfiles { + set split_file [split $tmp_filename "/"] + set filename [lindex $split_file [expr [llength $split_file] - 1]] + set mime_type [cr_filename_to_mime_type -create $filename] + set tmp_size [file size $tmp_filename] + + # We are going to create a new item. First we are going to check + # if the name already exists to generate a new one + set filename [lors_central::check_item_name -parent_id $folder_id -name $filename] + set new_file_item_id [content::item::new -name $filename -creation_user $user_id \ + -parent_id $folder_id] + set new_file_id [content::revision::new -item_id $new_file_item_id -title $filename \ + -creation_user $user_id -mime_type $mime_type -is_live "t"] + + # Now we store the content in the CR + set cr_file [cr_create_content_file $new_file_item_id $new_file_id $tmp_filename] + + # get the size + set file_size [cr_file_size $cr_file] + + # update the file path in the CR and the size on cr_revisions + db_dml update_revision { + update + cr_revisions + set + content = :cr_file, + content_length = :file_size + where + revision_id = :new_file_id + } - # Now that we have the new item store in the CR, we have to make - # some insert to some tables to adjust to the new cr_item. - # First we have to reflect the new file in the resources table. - # We need to create a new row in the ims_cp_files to associate the new resource to the new file - - db_dml insert_new_file { - insert into ims_cp_files (file_id, res_id, pathtofile, filename, hasmetadata) - values (:new_file_id, :new_res_rev_id, :filename, :filename, 'f') - } - } - - # Now are going to create a new item (ims_cp_item) - # We need the folder_id of the course to store the new item - set root_ims_folder [lors_central::get_root_items_folder_id] - set items_folder_id [db_string get_items_folder_id { }] + # Now that we have the new item store in the CR, we have to make + # some insert to some tables to adjust to the new cr_item. + # First we have to reflect the new file in the resources table. + # We need to create a new row in the ims_cp_files to associate the new resource to the new file + + db_dml insert_new_file { + insert into ims_cp_files (file_id, res_id, pathtofile, filename, hasmetadata) + values (:new_file_id, :new_res_rev_id, :filename, :filename, 'f') + } + file delete $tmp_filename + } + + # Now are going to create a new item (ims_cp_item) + # We need the folder_id of the course to store the new item + set root_ims_folder [lors_central::get_root_items_folder_id] + set items_folder_id [db_string get_items_folder_id { }] - # set new_ims_item_id [content::item::new -name $first_filename -creation_user $user_id \ - -parent_id $items_folder_id -content_type "ims_item_object"] - # set new_ims_rev_id [content::revision::new -item_id $new_ims_item_id -title $first_filename \ - -creation_user $user_id -is_live "t"] - set new_ims_item_id [content::item::new -name $item_title -creation_user $user_id \ - -parent_id $items_folder_id -content_type "ims_item_object"] - set new_ims_rev_id [content::revision::new -item_id $new_ims_item_id -title $item_title \ - -creation_user $user_id -is_live "t"] - - # We need to insert in the ims_cp_items at the proper sort_order so we are going - # to rearrenge the items sort_order and then fill the information for the item - db_foreach get_items_to_reorder { } { - set new_sort [expr $order + 1] - db_dml reorder_items { } - } - - db_dml update_ims_cp_items { - update ims_cp_items set + + set new_ims_item_id [content::item::new -name $item_title -creation_user $user_id \ + -parent_id $items_folder_id -content_type "ims_item_object"] + set new_ims_rev_id [content::revision::new -item_id $new_ims_item_id -title $item_title \ + -creation_user $user_id -is_live "t"] + + # We need to insert in the ims_cp_items at the proper sort_order so we are going + # to rearrenge the items sort_order and then fill the information for the item + db_foreach get_items_to_reorder { } { + set new_sort [expr $order + 1] + db_dml reorder_items { } + } + + db_dml update_ims_cp_items { + update ims_cp_items set org_id = :org_id, identifier = :first_filename, identifierref = :first_filename, item_title = :item_title, sort_order = :sort_order, parent_item = :parent - where ims_item_id = :new_ims_rev_id - } - # Now this new revision_id is the one that holds the content of the new resource - # We have to make a row in ims_cp_items_to_resources table - - db_dml insert_new_item_to_res { - insert into ims_cp_items_to_resources (ims_item_id, res_id ) - values (:new_ims_rev_id, :new_res_rev_id) - } - - # We also need to map this item to (ims_cp_items_map) - # We need to do it for every community that is associated to this course (man_id) - set com_list [db_list_of_lists get_community_id { - select distinct community_id from ims_cp_items_map - where man_id = :man_id - }] - foreach community_id $com_list { - db_dml insert_item { - insert into ims_cp_items_map - (man_id,org_id,community_id,ims_item_id) - values - (:man_id,:org_id,:community_id,:new_ims_rev_id) - } - } - } + where ims_item_id = :new_ims_rev_id + } + # Now this new revision_id is the one that holds the content of the new resource + # We have to make a row in ims_cp_items_to_resources table + + db_dml insert_new_item_to_res { + insert into ims_cp_items_to_resources (ims_item_id, res_id ) + values (:new_ims_rev_id, :new_res_rev_id) + } + + # We also need to map this item to (ims_cp_items_map) + # We need to do it for every community that is associated to this course (man_id) + set com_list [db_list_of_lists get_community_id { + select distinct community_id from ims_cp_items_map + where man_id = :man_id + }] + foreach community_id $com_list { + db_dml insert_item { + insert into ims_cp_items_map + (man_id,org_id,community_id,ims_item_id) + values + (:man_id,:org_id,:community_id,:new_ims_rev_id) + } + } - # We delete the temporary directory created when unzipping the file - exec rm -fr $tmp_dir + + # We delete the temporary directory created when unzipping the file + exec rm -fr $tmp_dir + } + } else { - db_transaction { - if { [empty_string_p $sort_order] } { - set max_sort_order [db_string get_max_sort_order { } ] - set sort_order [expr $max_sort_order + 1] - } else { - incr sort_order - } - set tmp_filename [ns_queryget file_upload.tmpfile] - set mime_type [cr_filename_to_mime_type -create $file_upload] - set tmp_size [file size $tmp_filename] - - # First we are going to create a new cr_item (file) for the new resource - # We need the folder_id of the course to store the new item - set course_name [lors_central::get_course_name -man_id $man_id] - set root_folder [lors_central::get_root_folder_id] - set folder_id [db_string get_folder_id { }] - - - # We are going to create a new item. First we are going to check - # if the name already exists to generate a new one - set file_upload [lors_central::check_item_name -parent_id $folder_id -name $file_upload] - set new_file_item_id [content::item::new -name $file_upload -creation_user $user_id \ - -parent_id $folder_id] - set new_file_id [content::revision::new -item_id $new_file_item_id -title $file_upload -creation_user $user_id \ - -mime_type $mime_type -is_live "t"] - - # Now we store the content in the CR - set cr_file [cr_create_content_file $new_file_item_id $new_file_id $tmp_filename] - - # get the size - set file_size [cr_file_size $cr_file] - - # update the file path in the CR and the size on cr_revisions - db_dml update_revision { - update - cr_revisions - set - content = :cr_file, - content_length = :file_size - where - revision_id = :new_file_id - } - - # Now that we have the new item store in the CR, we have to make - # some insert to some tables to adjust to the new cr_item. - # First we have to reflect the new file in the resources table, so we have to make - # a new cr_item and revision for the resource and insert it on the ims_cp_resources table - - # We need to know where the new resource should be - set res_root_folder_id [lors_central::get_root_resources_folder_id] - set res_folder_id [lors_central::folder_id_from_man_parent -man_id $man_id -parent_id $res_root_folder_id] - - set new_res_item_id [content::item::new -name $file_upload -creation_user $user_id \ - -parent_id $res_folder_id -content_type "ims_resource_object"] - - set new_res_rev_id [content::revision::new -item_id $new_res_item_id -title $file_upload \ - -creation_user $user_id -is_live "t"] - - - # Now we have to update the new row in the ims_cp_resources using this new resource (new_res_id) - # we need a new href - set new_href "$file_upload" - - db_dml update_new_res { - update - ims_cp_resources - set - man_id = :man_id, - identifier = :file_upload, - type = 'webcontent', - href = :new_href, - hasmetadata = 'f' - where - res_id = :new_res_rev_id - } - # We need to create a new row in the ims_cp_files to associate the new resource to the new file - db_dml insert_new_file { - insert into ims_cp_files (file_id, res_id, pathtofile, filename, hasmetadata) - values (:new_file_id, :new_res_rev_id, :new_href, :file_upload, 'f') - } - - # Now are going to create a new item (ims_cp_item) - # We need the folder_id of the course to store the new item - set root_ims_folder [lors_central::get_root_items_folder_id] - set items_folder_id [db_string get_items_folder_id { }] + db_transaction { + set tmp_filename [ns_queryget file_upload.tmpfile] + if { [empty_string_p $sort_order] } { + set max_sort_order [db_string get_max_sort_order { } ] + set sort_order [expr $max_sort_order + 1] + } else { + incr sort_order + } + set mime_type [cr_filename_to_mime_type -create $file_upload] + set tmp_size [file size $tmp_filename] + + # First we are going to create a new cr_item (file) for the new resource + # We need the folder_id of the course to store the new item + set course_name [lors_central::get_course_name -man_id $man_id] + set root_folder [lors_central::get_root_folder_id] + set folder_id [db_string get_folder_id { }] + + + # We are going to create a new item. First we are going to check + # if the name already exists to generate a new one + set file_upload [lors_central::check_item_name -parent_id $folder_id -name $file_upload] + set new_file_item_id [content::item::new -name $file_upload -creation_user $user_id \ + -parent_id $folder_id] + set new_file_id [content::revision::new -item_id $new_file_item_id -title $file_upload -creation_user $user_id \ + -mime_type $mime_type -is_live "t"] + + # Now we store the content in the CR + set cr_file [cr_create_content_file $new_file_item_id $new_file_id $tmp_filename] + + # get the size + set file_size [cr_file_size $cr_file] + + # update the file path in the CR and the size on cr_revisions + db_dml update_revision { + update + cr_revisions + set + content = :cr_file, + content_length = :file_size + where + revision_id = :new_file_id + } + + # Now that we have the new item store in the CR, we have to make + # some insert to some tables to adjust to the new cr_item. + # First we have to reflect the new file in the resources table, so we have to make + # a new cr_item and revision for the resource and insert it on the ims_cp_resources table + + # We need to know where the new resource should be + set res_root_folder_id [lors_central::get_root_resources_folder_id] + set res_folder_id [lors_central::folder_id_from_man_parent -man_id $man_id -parent_id $res_root_folder_id] + + set new_res_item_id [content::item::new -name $file_upload -creation_user $user_id \ + -parent_id $res_folder_id -content_type "ims_resource_object"] + + set new_res_rev_id [content::revision::new -item_id $new_res_item_id -title $file_upload \ + -creation_user $user_id -is_live "t"] + + + # Now we have to update the new row in the ims_cp_resources using this new resource (new_res_id) + # we need a new href + set new_href "$file_upload" + + db_dml update_new_res { + update + ims_cp_resources + set + man_id = :man_id, + identifier = :file_upload, + type = 'webcontent', + href = :new_href, + hasmetadata = 'f' + where + res_id = :new_res_rev_id + } + # We need to create a new row in the ims_cp_files to associate the new resource to the new file + db_dml insert_new_file { + insert into ims_cp_files (file_id, res_id, pathtofile, filename, hasmetadata) + values (:new_file_id, :new_res_rev_id, :new_href, :file_upload, 'f') + } + + # Now are going to create a new item (ims_cp_item) + # We need the folder_id of the course to store the new item + set root_ims_folder [lors_central::get_root_items_folder_id] + set items_folder_id [db_string get_items_folder_id { }] - #set new_ims_item_id [content::item::new -name $file_upload -creation_user $user_id -parent_id $items_folder_id \ - -content_type "ims_item_object"] - #set new_ims_rev_id [content::revision::new -item_id $new_ims_item_id -title $file_upload \ - -creation_user $user_id -is_live "t"] - set new_ims_item_id [content::item::new -name $item_title -creation_user $user_id -parent_id $items_folder_id \ - -content_type "ims_item_object"] - set new_ims_rev_id [content::revision::new -item_id $new_ims_item_id -title $item_title \ - -creation_user $user_id -is_live "t"] - - # We need to insert in the ims_cp_items at the proper sort_order so we are going - # to rearrenge the items sort_order and then fill the information for the item - db_foreach get_items_to_reorder { } { - set new_sort [expr $order + 1] - db_dml reorder_items { } - } - - db_dml update_ims_cp_items { - update ims_cp_items set + set new_ims_item_id [content::item::new -name $item_title -creation_user $user_id -parent_id $items_folder_id \ + -content_type "ims_item_object"] + set new_ims_rev_id [content::revision::new -item_id $new_ims_item_id -title $item_title \ + -creation_user $user_id -is_live "t"] + + # We need to insert in the ims_cp_items at the proper sort_order so we are going + # to rearrenge the items sort_order and then fill the information for the item + db_foreach get_items_to_reorder { } { + set new_sort [expr $order + 1] + db_dml reorder_items { } + } + + db_dml update_ims_cp_items { + update ims_cp_items set org_id = :org_id, identifier = :file_upload, identifierref = :file_upload, item_title = :item_title, sort_order = :sort_order, parent_item = :parent - where ims_item_id = :new_ims_rev_id - } - # Now this new revision_id is the one that holds the content of the new resource - # We have to make a row in ims_cp_items_to_resources table - - db_dml insert_new_item_to_res { - insert into ims_cp_items_to_resources (ims_item_id, res_id ) - values (:new_ims_rev_id, :new_res_rev_id) - } - - # We also need to map this item to (ims_cp_items_map) - # We need to do it for every community that is associated to this course (man_id) - set com_list [db_list_of_lists get_community_id { - select distinct community_id from ims_cp_items_map - where man_id = :man_id - }] - foreach community_id $com_list { - db_dml insert_item { - insert into ims_cp_items_map - (man_id,org_id,community_id,ims_item_id) - values - (:man_id,:org_id,:community_id,:new_ims_rev_id) - } - } - } + where ims_item_id = :new_ims_rev_id + } + # Now this new revision_id is the one that holds the content of the new resource + # We have to make a row in ims_cp_items_to_resources table + + db_dml insert_new_item_to_res { + insert into ims_cp_items_to_resources (ims_item_id, res_id ) + values (:new_ims_rev_id, :new_res_rev_id) + } + + # We also need to map this item to (ims_cp_items_map) + # We need to do it for every community that is associated to this course (man_id) + set com_list [db_list_of_lists get_community_id { + select distinct community_id from ims_cp_items_map + where man_id = :man_id + }] + foreach community_id $com_list { + db_dml insert_item { + insert into ims_cp_items_map + (man_id,org_id,community_id,ims_item_id) + values + (:man_id,:org_id,:community_id,:new_ims_rev_id) + } + } + } + file delete $tmp_filename } } -after_submit { - ad_returnredirect "one-learning-object?man_id=$man_id&ims_item_id=$new_ims_rev_id" -} + ad_returnredirect "one-learning-object?man_id=$man_id&ims_item_id=$new_ims_rev_id" + } Index: openacs-4/packages/lors-central/www/one-course-associations.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-course-associations.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/lors-central/www/one-course-associations.tcl 9 Jun 2005 21:03:16 -0000 1.3 +++ openacs-4/packages/lors-central/www/one-course-associations.tcl 22 Jan 2007 08:09:25 -0000 1.4 @@ -117,7 +117,7 @@ class { label "[_ lors-central.class_name]" display_template { - @cl_list.pretty_name@ + @cl_list.pretty_name@ [_ lors-central.views] @@ -186,7 +186,7 @@ set orderby_clause [template::list::orderby_clause -orderby -name "dotlrn_classes"] -db_multirow -extend { ver_num ver_count manifest_id options tracking } cl_list get_dotlrn_classes { } { +db_multirow -extend { course_url ver_num ver_count manifest_id options tracking } cl_list get_dotlrn_classes { } { set manifest_id [lors_central::get_man_id -community_id $com_id -item_id $item_id] set ver_count [lors_central::count_versions -man_id $manifest_id] set ver_num [lors_central::get_version_num -revision_id $manifest_id] @@ -200,6 +200,11 @@ append options "