Index: openacs-4/packages/lors/lib/course-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/lors/lib/course-new.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/lors/lib/course-new.tcl 8 Oct 2008 13:01:05 -0000 1.5
+++ openacs-4/packages/lors/lib/course-new.tcl 17 Nov 2008 13:35:00 -0000 1.6
@@ -16,43 +16,49 @@
if {![info exists package_id]} {
set package_id [ad_conn package_id]
}
-ad_form -name course-new -export {return_url package_id folder_id} -form {
- man_id:key
- {name:text(text) {label "Course Name"} {size 50}}
-} -new_data {
- # FIXME only works with dotlrn, lame, should just create a lors
- # folder as a child of the package_id of the manifest object
+ad_form \
+ -name course-new \
+ -export {return_url package_id folder_id} \
+ -form {
+ man_id:key
+ {name:text(text)
+ {label "Course Name"} {size 50}}
- set new_parent_id [lors::cr::add_folder \
- -parent_id $folder_id \
- -folder_name $name]
- set new_items_parent_id [lors::cr::add_folder \
- -parent_id $folder_id \
- -folder_name "${name}_items"]
-
- lors::imscp::manifest_add \
- -man_id $man_id \
- -course_name $name \
- -identifier [util_text_to_url -text $name] \
- -hasmetadata f \
- -isscorm f \
- -package_id $package_id \
- -community_id $community_id \
- -folder_id $new_items_parent_id \
- -content_folder_id $new_parent_id
+ } -new_data {
+ # FIXME only works with dotlrn, lame, should just create a lors
+ # folder as a child of the package_id of the manifest object
- lors::imscp::organization_add \
- -man_id $man_id \
- -identifier [util_text_to_url -text $name] \
- -org_folder_id $new_items_parent_id
-
- if {[info exists return_url_base] && $return_url_base ne ""} {
- set return_url [export_vars -base $return_url_base {man_id}]
- }
- if {![info exists return_url] || $return_url eq ""} {
- set return_url [export_vars -base course-structure {man_id}]
- }
- ad_returnredirect -message "[_ lors.Course_created]" $return_url
+ set new_parent_id [lors::cr::add_folder \
+ -parent_id $folder_id \
+ -folder_name $name]
+ set new_items_parent_id [lors::cr::add_folder \
+ -parent_id $folder_id \
+ -folder_name "${name}_items"]
-}
+ lors::imscp::manifest_add \
+ -man_id $man_id \
+ -course_name $name \
+ -identifier [util_text_to_url -text $name] \
+ -hasmetadata f \
+ -isscorm f \
+ -package_id $package_id \
+ -community_id $community_id \
+ -folder_id $new_items_parent_id \
+ -content_folder_id $new_parent_id
+
+ lors::imscp::organization_add \
+ -man_id $man_id \
+ -identifier [util_text_to_url -text $name] \
+ -org_folder_id $new_items_parent_id
+
+ if {[info exists return_url_base] && $return_url_base ne ""} {
+ set return_url [export_vars -base $return_url_base {man_id}]
+ }
+
+ if {![info exists return_url] || $return_url eq ""} {
+ set return_url [export_vars -base course-structure {man_id}]
+ }
+
+ ad_returnredirect -message "[_ lors.Course_created]" $return_url
+ }
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.8 -r1.9
--- openacs-4/packages/lors/lib/course-structure.adp 8 Oct 2008 13:01:05 -0000 1.8
+++ openacs-4/packages/lors/lib/course-structure.adp 17 Nov 2008 13:35:01 -0000 1.9
@@ -1,153 +1,103 @@
+
-
-
-
- #lorsm.Metadata#
- |
-
-
-
- #lorsm.Yes#
-
-
- #lorsm.Yes#
-
+
+
+ #lorsm.Metadata# |
+
+
+ #lorsm.Yes#
+ #lorsm.Yes#
-
- #lorsm.No#
-
- |
-
-
-
- #lorsm.Is_SCORM#
- |
-
- #lorsm.lt_classlist_stylefont-w#
-
-
- class="list"
-
+ #lorsm.No#
+ |
+
+
+
+ #lorsm.Is_SCORM# |
+ #lorsm.lt_classlist_stylefont-w#
+ class="list"
valign="top" align="left">@isscorm;noquote@
- |
-
-
-
- #lorsm.Storage_Folder#
- |
-
- @instance@
- |
-
-
-
- #lorsm.Created_By#
- |
-
- @created_by@
- |
-
-
-
- #lorsm.Date#
- |
-
- @creation_date;noquote@
- |
-
-
-
- #lorsm.Submanifests#
- |
-
- @submanifests@
- |
-
-
-
- #lorsm.Status#
- |
-
-
- #lorsm.Enabled#
-
-
- #lorsm.Disabled#
-
-
- |
-
-
-
- #lorsm.Trackable#
- |
-
-
- #lorsm.Yes#
- ( #lorsm.lt_Track_Students_Progre# )
-
-
- #lorsm.No#
-
-
- |
-
-
-
- #lorsm.Is_shared#
- |
-
-
- #lorsm.Shared#
-
-
- #lorsm.Not_Shared#
-
-
- |
-
-
-
- #lorsm.Course#
- |
-
- @format_pretty_name@
-
- |
-
-
+ |
+
+
+
+ #lorsm.Storage_Folder# |
+ @instance@ |
+
+
+
+ #lorsm.Created_By# |
+ @created_by@ |
+
+
+
+ #lorsm.Date# |
+ @creation_date;noquote@ |
+
+
+
+ #lorsm.Submanifests# |
+ @submanifests@ |
+
+
+
+ #lorsm.Status# |
+
+ #lorsm.Enabled#
+ #lorsm.Disabled#
+
+ |
+
+
+
+ #lorsm.Trackable# |
+
+ #lorsm.Yes#( #lorsm.lt_Track_Students_Progre# )
+ #lorsm.No#
+
+ |
+
+
+
+ #lorsm.Is_shared# |
+
+ #lorsm.Shared#
+ #lorsm.Not_Shared#
+
+ |
+
+
+
+ #lorsm.Course# |
+
+ @format_pretty_name@
+
+ |
+
+
+
@extra_admin_html;noquote@
- @orgs_list;noquote@
-
+@orgs_list;noquote@
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.12 -r1.13
--- openacs-4/packages/lors/lib/course-structure.tcl 8 Oct 2008 13:01:05 -0000 1.12
+++ openacs-4/packages/lors/lib/course-structure.tcl 17 Nov 2008 13:35:01 -0000 1.13
@@ -1,9 +1,9 @@
# packages/lorsm/www/course_structure.tcl
ad_page_contract {
-
+
View Manifest Course Structure
-
+
@author Ernie Ghiglione (ErnieG@mm.st)
@creation-date 2004-03-31
@arch-tag 208f2801-d110-45d3-9401-d5eae1f72c93
@@ -13,21 +13,23 @@
@param exclude list of cr_items.item_ids of ims_cp_items to exclude from
the display (optional)
}
+
set package_id [ad_conn package_id]
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
+ } {
+ Gets the Folderkey for a file-storage folder_id
- @option object_id Folder_id for file-storage folder
- @author Ernie Ghiglione (ErnieG@mm.st)
+ @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"]
-}
+ } {
+ 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]"]
@@ -36,36 +38,36 @@
if {[db_0or1row manifest { }]} {
- # Sets the variable for display.
+ # Sets the variable for display.
set display 1
-
+
# Course Name
if {[empty_string_p $course_name]} {
set course_name "[_ lorsm.No_course_Name]"
- }
+ }
# Version
set version [db_string get_versions { } -default 0]
if {[string equal $version "0"]} {
set version_msg "[_ lorsm.No_version_Available]"
- }
-
+ }
+
if { ![empty_string_p $fs_package_id] } {
# Folder
set folder [apm_package_url_from_id $fs_package_id]?[export_vars folder_id]
# Instance
set instance [apm_package_key_from_id $fs_package_id]
} else {
set fs_package_id [site_node_apm_integration::get_child_package_id \
- -package_id [dotlrn_community::get_package_id $community_id] \
- -package_key "file-storage"]
+ -package_id [dotlrn_community::get_package_id $community_id] \
+ -package_key "file-storage"]
# Instance
set instance [lorsm::get_course_name -manifest_id $man_id]
+
# Folder
- set root_folder [lorsm::get_root_folder_id]
-
- set folder_id [db_string get_folder_id { }]
+ set root_folder [lorsm::get_root_folder_id]
+ set folder_id [db_string get_folder_id { }]
set folder [apm_package_url_from_id $fs_package_id]?[export_vars folder_id]
}
@@ -81,24 +83,28 @@
set submanifests 0
}
-
} else {
-
set display 0
-
}
-append orgs_list ""
+append orgs_list \
+ ""
set pretty_types_map {}
if { [apm_package_installed_p assessment] } {
- append pretty_types_map "as_sections Questions"
+ append pretty_types_map "as_sections Questions"
}
+
if { [apm_package_installed_p xowiki] } {
- append pretty_types_map "::xowiki::Page Content"
+ append pretty_types_map "::xowiki::Page Content"
}
-template::multirow create items course_name delete down folder_id fs_package_id hasmetadata href identifierref indent isshared item_id item_title object_id org_id res_identifier type up
+
+template::multirow create items \
+ course_name delete down folder_id fs_package_id hasmetadata href \
+ identifierref indent isshared item_id item_title object_id org_id \
+ res_identifier type up
+
db_multirow organizations organizations { } { }
if {[info exists exclude] && [llength $exclude]} {
@@ -109,21 +115,33 @@
}
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 \
+ "select count(*)
+ from ims_cp_items i
+ where org_id=:org_id $exclude_where" -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
-
+
db_multirow items get_items "" {
if {[info exists indent_array($item_id)]} {
set indent [string repeat " " [expr {$indent_array($item_id)-1}]]
- } else { set indent 1 }
- 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]"
- } else {
- set href "[lors::object_url -url admin -object_id $res_identifier -man_id $man_id]"
- }
+ } else {
+ set indent 1
+ }
+
+ 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]"
+ } else {
+ set href "[lors::object_url \
+ -url admin \
+ -object_id $res_identifier \
+ -man_id $man_id]"
+ }
+
set type [string map $pretty_types_map $type]
set delete [export_vars -base object-delete {item_id return_url}]
set up [export_vars -base reorder-items {item_id {dir up} return_url}]
@@ -145,33 +163,48 @@
set add_type_options [list]
if { [apm_package_installed_p assessment] } {
- lappend add_type_options [list Questions assessment]
+ lappend add_type_options [list Questions assessment]
}
+
if { [apm_package_installed_p xowiki] } {
- lappend add_type_options [list Content wiki]
+ lappend add_type_options [list Content wiki]
}
-ad_form -name add-new -action object-new -export {man_id} -form {
- {add_type:text(select) {label ""} {options $add_type_options}}
- {add_new:text(submit) {label {[_ acs-kernel.common_Add]}}}
-}
+ad_form \
+ -name add-new \
+ -action object-new \
+ -export {man_id} \
+ -form {
+ {add_type:text(select)
+ {label ""}
+ {options $add_type_options}}
+ {add_new:text(submit)
+ {label {[_ acs-kernel.common_Add]}}}
+ }
+
template::list::create \
-name items \
-multirow items \
-elements {
item_title {
label "\#lorsm.Items\#"
link_url_col href
- }
- type {
+
+ } type {
label "Type"
- }
- actions {
+
+ } actions {
label "Actions"
display_template {
- Up Down Remove
+ \
+ Up \
+ \
+ \
+ Down \
+
+ Remove
}
}
}
-set rename_url [export_vars -base course-rename {man_id}]
\ No newline at end of file
+set rename_url [export_vars -base course-rename {man_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.3 -r1.4
--- openacs-4/packages/lors/lib/object-new.tcl 6 Apr 2007 19:27:00 -0000 1.3
+++ openacs-4/packages/lors/lib/object-new.tcl 17 Nov 2008 13:35:01 -0000 1.4
@@ -7,34 +7,41 @@
switch $add_type {
assessment {
# get a list of assessment
- set dotlrn_package_id [dotlrn_community::get_community_id]
- 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"]
- }
- wiki {
+ set dotlrn_package_id [dotlrn_community::get_community_id]
+ 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"]
+ } wiki {
# get a list of all the wiki pages
# find xowiki package
array set xowiki_node [site_node::get_from_url -url /wiki]
-
+
# get the folder_id
- set folder_id [::xowiki::Page require_folder -package_id $xowiki_node(object_id) -name xowiki]
+ set folder_id [::xowiki::Page require_folder \
+ -package_id $xowiki_node(object_id) \
+ -name xowiki]
+
set options [list]
set order_clause "order by ci.name"
db_foreach instance_select \
[::xowiki::Page instance_select_query \
- -folder_id $folder_id \
- -with_subtypes t \
- -select_attributes [list title last_modified] \
- -order_clause $order_clause \
- ] {
- lappend options [list $title $item_id]
- }
+ -folder_id $folder_id \
+ -with_subtypes t \
+ -select_attributes [list title last_modified] \
+ -order_clause $order_clause] \
+ { lappend options [list $title $item_id] }
+
+ } webcontent {
+ ad_returnredirect [export_vars -base item-add-edit {man_id}]
+ ad_script_abort
}
- webcontent {
- ad_returnredirect [export_vars -base item-add-edit {man_id}]
- ad_script_abort
- }
}
set search_p 0
@@ -48,109 +55,138 @@
# show available objects
set options [concat [list [list "-- Choose --" ""]] $options]
-ad_form -name choose -export {man_id add_type} -form {
- {existing_object:text(select) {label "[_ acs-kernel.common_Add]"} {options $options}}
-} -on_submit {
- # 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"]
- switch $add_type {
- assessment {
- # we want one lors item per section
+ad_form \
+ -name choose \
+ -export {man_id add_type} \
+ -form {
+ {existing_object:text(select)
+ {label "[_ acs-kernel.common_Add]"}
+ {options $options}}
-
- 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"]
+ } -on_submit {
+ # 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"]
+ 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"]
- foreach {section} $sections {
+ foreach {section} $sections {
+ foreach {section_item_id section_name section_title} \
+ [lrange $section 0 2] {break}
+ # ad_return_complaint 1 "$section_name $section_title"
+ # make sure this section isn't already associated with this course
+ # we'll just let an admin add the assessment as many times
+ # as they like, if there a new sections they will get added
- foreach {section_item_id section_name section_title} [lrange $section 0 2] {break}
-# ad_return_complaint 1 "$section_name $section_title"
- # make sure this section isn't already associated with this course
- # 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 \
+ "select res_id
+ from ims_cp_resources
+ where identifier=:section_item_id
+ and man_id=:man_id"]} {
+ 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"]} {
+ set item_id [lors::imscp::item_add_from_object \
+ -object_id $section_item_id \
+ -org_id $org_id \
+ -folder_id $item_folder_id \
+ -title $section_title]
+ lors::imscp::item_to_resource_add \
+ -item_id $item_id \
+ -res_id $res_id
+ }
+
+ # FIXME see if anyone is using this resource
+ # already. objects should be # able to be resources
+ # without being tied to one manifest, # since you can use
+ # a resource in more than one course and # it doesn't make
+ # sense to have a seperate row every time # we reuse an
+ # object DAVEB 2070321 - of course, it adds complexity and
+ # special handling, and this works for now.
+ }
+
+ } wiki {
+ 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"]} {
set res_id [lors::imscp::resource_add_from_object \
-man_id $man_id \
- -object_id $section_item_id \
+ -object_id $existing_object \
-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 \
+ "select ims_item_id
+ from ims_cp_items
+ where org_id=:org_id
+ and identifier='::xowiki::Page_' || :existing_object"]} {
set item_id [lors::imscp::item_add_from_object \
- -object_id $section_item_id \
- -org_id $org_id \
- -folder_id $item_folder_id \
- -title $section_title]
- lors::imscp::item_to_resource_add \
- -item_id $item_id \
- -res_id $res_id
+ -object_id $existing_object \
+ -org_id $org_id \
+ -folder_id $item_folder_id \
+ -title $page_title]
+ }
+ # FIXME see if anyone is using this resource
+ # already. objects should be # able to be resources
+ # without being tied to one manifest, # since you can use
+ # a resource in more than one course and # it doesn't make
+ # sense to have a seperate row every time # we reuse an
+ # object
- }
-
- # FIXME see if anyone is using this resource
- # already. objects should be # able to be resources
- # without being tied to one manifest, # since you can use
- # a resource in more than one course and # it doesn't make
- # sense to have a seperate row every time # we reuse an
- # object DAVEB 2070321 - of course, it adds complexity and
- # special handling, and this works for now.
-
- }
+ lors::imscp::item_to_resource_add \
+ -item_id $item_id \
+ -res_id $res_id
+ }
}
- wiki {
-
- 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"]} {
- 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"]} {
- set item_id [lors::imscp::item_add_from_object \
- -object_id $existing_object \
- -org_id $org_id \
- -folder_id $item_folder_id \
- -title $page_title]
- }
- # FIXME see if anyone is using this resource
- # already. objects should be # able to be resources
- # without being tied to one manifest, # since you can use
- # a resource in more than one course and # it doesn't make
- # sense to have a seperate row every time # we reuse an
- # object
-
- lors::imscp::item_to_resource_add \
- -item_id $item_id \
- -res_id $res_id
+ ad_returnredirect $return_url
+ ad_script_abort
+ }
- }
- }
- ad_returnredirect $return_url
- ad_script_abort
-}
+ad_form \
+ -name new \
+ -export {man_id add_type} \
+ -form {
+ {name:text(text) {label "Name"}}
-ad_form -name new -export {man_id add_type} -form {
- {name:text(text) {label "Name"}}
-} -on_submit {
- switch $add_type {
- wiki {
- set url [export_vars -base /wiki/edit {name return_url}]
+ } -on_submit {
+ switch $add_type {
+ wiki {
+ set url [export_vars -base /wiki/edit {name return_url}]
+
+ } assessment {
+ set url [export_vars -base ../assessment/asm-admin/assessment-form { name return_url}]
+ }
}
- assessment {
- set url [export_vars -base ../assessment/asm-admin/assessment-form { name return_url}]
- }
+ ad_returnredirect $url
+ ad_script_abort
}
- ad_returnredirect $url
- ad_script_abort
-}
-
-
-
-
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.2 -r1.3
--- openacs-4/packages/lors/tcl/apm-callbacks-procs.tcl 7 Jun 2006 13:45:20 -0000 1.2
+++ openacs-4/packages/lors/tcl/apm-callbacks-procs.tcl 17 Nov 2008 13:35:02 -0000 1.3
@@ -14,349 +14,300 @@
Makes the upgrade of lors-central package
} {
apm_upgrade_logic \
- -from_version_name $from_version_name \
- -to_version_name $to_version_name \
- -spec {
- 0.6d3 0.6d4 {
- lors::apm_callback::upgrade_code
- }
- }
+ -from_version_name $from_version_name \
+ -to_version_name $to_version_name \
+ -spec {
+ 0.6d3 0.6d4 {
+ lors::apm_callback::upgrade_code
+ }
+ }
}
-ad_proc -public lors::apm_callback::upgrade_code {
+ad_proc -public lors::apm_callback::upgrade_code {
} {
set user_id [ad_conn user_id]
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 {
+ select *
+ from ims_cp_manifests_copy }]
+
foreach man_info $manifests_list {
- set original_man_id [lindex $man_info 0]
- set course_name [lindex $man_info 1]
- set man_identifier [lindex $man_info 2]
- set version [lindex $man_info 3]
- set orgs_default [lindex $man_info 4]
- set hasmetadata [lindex $man_info 5]
- set parent_man_id [lindex $man_info 6]
- set isscorm [lindex $man_info 7]
- set folder_id [lindex $man_info 8]
- set fs_package_id [lindex $man_info 9]
- set isshared [lindex $man_info 10]
- 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
- }
+ set original_man_id [lindex $man_info 0]
+ set course_name [lindex $man_info 1]
+ set man_identifier [lindex $man_info 2]
+ set version [lindex $man_info 3]
+ set orgs_default [lindex $man_info 4]
+ set hasmetadata [lindex $man_info 5]
+ set parent_man_id [lindex $man_info 6]
+ set isscorm [lindex $man_info 7]
+ set folder_id [lindex $man_info 8]
+ set fs_package_id [lindex $man_info 9]
+ set isshared [lindex $man_info 10]
+ set package_id [lindex $man_info 11]
- set items_parent_id [lors::cr::add_folder -parent_id $parent_id -folder_name "${cr_dir}_items"]
-
- # Now we have to create a new cr_item and revision for the man_id
- set new_man_item_id [content::item::new \
- -name $man_identifier \
- -content_type "ims_manifest_object" \
- -parent_id $items_parent_id \
- -creation_date [dt_sysdate] \
- -creation_user $user_id \
- -creation_ip $creation_ip \
- -context_id $package_id]
+ # 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
+ }
- set new_man_revision_id [content::revision::new \
- -item_id $new_man_item_id \
- -title $man_identifier \
- -description "Upgraded using lors" \
- -creation_date [dt_sysdate] \
- -creation_ip $creation_ip \
- -creation_user $user_id \
- -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
- }
+ set items_parent_id [lors::cr::add_folder \
+ -parent_id $parent_id \
+ -folder_name "${cr_dir}_items"]
- # 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 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
- }
+ # Now we have to create a new cr_item and revision for the man_id
+ set new_man_item_id [content::item::new \
+ -name $man_identifier \
+ -content_type "ims_manifest_object" \
+ -parent_id $items_parent_id \
+ -creation_date [dt_sysdate] \
+ -creation_user $user_id \
+ -creation_ip $creation_ip \
+ -context_id $package_id]
- # 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 }]
- foreach res_info $resources_list {
- set original_res_id [lindex $res_info 0]
- set man_id $new_man_revision_id
- set res_identifier [lindex $res_info 2]
- set type [lindex $res_info 3]
- set href [lindex $res_info 4]
- set hasmetadata [lindex $res_info 5]
- set scorm_type [lindex $res_info 6]
+ set new_man_revision_id [content::revision::new \
+ -item_id $new_man_item_id \
+ -title $man_identifier \
+ -description "Upgraded using lors" \
+ -creation_date [dt_sysdate] \
+ -creation_ip $creation_ip \
+ -creation_user $user_id \
+ -is_live "t"]
-
- # Now we have to create a new cr_item and revision for the res_id
- set new_res_item_id [content::item::new \
- -name $res_identifier \
- -content_type "ims_resource_object" \
- -parent_id $items_parent_id \
- -creation_date [dt_sysdate] \
- -creation_user $user_id \
- -creation_ip $creation_ip \
- -context_id $package_id]
-
- set new_res_revision_id [content::revision::new \
- -item_id $new_res_item_id \
- -title $res_identifier \
- -description "Upgraded using lors" \
- -creation_date [dt_sysdate] \
- -creation_ip $creation_ip \
- -creation_user $user_id \
- -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
- }
+ # 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_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
- }
+ # 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
+ }
- # 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 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
- }
-
- # 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 }]
- foreach org_info $organizations_list {
- set original_org_id [lindex $org_info 0]
- set org_man_id $new_man_revision_id
- set org_identifier [lindex $org_info 2]
- set structure [lindex $org_info 3]
- set org_title [lindex $org_info 4]
- set hasmetadata [lindex $org_info 5]
- set isshared [lindex $org_info 6]
+ 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
+ }
- # Now we have to create a new cr_item and revision for the org_id
- set new_org_item_id [content::item::new \
- -name $org_identifier \
- -content_type "ims_organization_object" \
- -parent_id $items_parent_id \
- -creation_date [dt_sysdate] \
- -creation_user $user_id \
- -creation_ip $creation_ip \
- -context_id $package_id]
-
- set new_org_revision_id [content::revision::new \
- -item_id $new_org_item_id \
- -title $org_identifier \
- -description "Upgraded using lors" \
- -creation_date [dt_sysdate] \
- -creation_ip $creation_ip \
- -creation_user $user_id \
- -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
- }
+ # 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 }]
+ foreach res_info $resources_list {
+ set original_res_id [lindex $res_info 0]
+ set man_id $new_man_revision_id
+ set res_identifier [lindex $res_info 2]
+ set type [lindex $res_info 3]
+ set href [lindex $res_info 4]
+ set hasmetadata [lindex $res_info 5]
+ set scorm_type [lindex $res_info 6]
- # 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 sort_order 0
- foreach item_info $items_list {
- set original_item_id [lindex $item_info 0]
- set org_id $new_org_revision_id
- set item_identifier [lindex $item_info 2]
- set identifierref [lindex $item_info 3]
- set isvisible [lindex $item_info 4]
- set parameters [lindex $item_info 5]
- set ims_item_title [lindex $item_info 6]
- set parent_item [lindex $item_info 7]
- set hasmetadata [lindex $item_info 8]
- set prerequisites_t [lindex $item_info 9]
- set prerequisites_s [lindex $item_info 10]
- set type [lindex $item_info 11]
- set maxtimeallowed [lindex $item_info 12]
- set timelimitaction [lindex $item_info 13]
- set datafromlms [lindex $item_info 14]
- set masteryscore [lindex $item_info 15]
- set isshared [lindex $item_info 16]
- incr sort_order
- # Now we have to create a new cr_item and revision for the ims_item_id
- set new_ims_item_id [content::item::new \
- -name $item_identifier \
- -content_type "ims_item_object" \
- -parent_id $items_parent_id \
- -creation_date [dt_sysdate] \
- -creation_user $user_id \
- -creation_ip $creation_ip \
- -context_id $package_id]
-
- set new_ims_revision_id [content::revision::new \
- -item_id $new_ims_item_id \
- -title $item_identifier \
- -description "Upgraded using lors" \
- -creation_date [dt_sysdate] \
- -creation_ip $creation_ip \
- -creation_user $user_id \
- -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
- }
+ # Now we have to create a new cr_item and revision for the res_id
+ set new_res_item_id [content::item::new \
+ -name $res_identifier \
+ -content_type "ims_resource_object" \
+ -parent_id $items_parent_id \
+ -creation_date [dt_sysdate] \
+ -creation_user $user_id \
+ -creation_ip $creation_ip \
+ -context_id $package_id]
- 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
- }
-
- # END foreach item_info
- }
- # END foreach org_info
- }
- # END foreach man_info
- }
+ set new_res_revision_id [content::revision::new \
+ -item_id $new_res_item_id \
+ -title $res_identifier \
+ -description "Upgraded using lors" \
+ -creation_date [dt_sysdate] \
+ -creation_ip $creation_ip \
+ -creation_user $user_id \
+ -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_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
+ }
+
+ # 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 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
+ }
+ }; # 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 }]
+ foreach org_info $organizations_list {
+ set original_org_id [lindex $org_info 0]
+ set org_man_id $new_man_revision_id
+ set org_identifier [lindex $org_info 2]
+ set structure [lindex $org_info 3]
+ set org_title [lindex $org_info 4]
+ set hasmetadata [lindex $org_info 5]
+ set isshared [lindex $org_info 6]
+
+ # Now we have to create a new cr_item and revision for the org_id
+ set new_org_item_id [content::item::new \
+ -name $org_identifier \
+ -content_type "ims_organization_object" \
+ -parent_id $items_parent_id \
+ -creation_date [dt_sysdate] \
+ -creation_user $user_id \
+ -creation_ip $creation_ip \
+ -context_id $package_id]
+
+ set new_org_revision_id [content::revision::new \
+ -item_id $new_org_item_id \
+ -title $org_identifier \
+ -description "Upgraded using lors" \
+ -creation_date [dt_sysdate] \
+ -creation_ip $creation_ip \
+ -creation_user $user_id \
+ -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
+ }
+
+ # 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 sort_order 0
+ foreach item_info $items_list {
+ set original_item_id [lindex $item_info 0]
+ set org_id $new_org_revision_id
+ set item_identifier [lindex $item_info 2]
+ set identifierref [lindex $item_info 3]
+ set isvisible [lindex $item_info 4]
+ set parameters [lindex $item_info 5]
+ set ims_item_title [lindex $item_info 6]
+ set parent_item [lindex $item_info 7]
+ set hasmetadata [lindex $item_info 8]
+ set prerequisites_t [lindex $item_info 9]
+ set prerequisites_s [lindex $item_info 10]
+ set type [lindex $item_info 11]
+ set maxtimeallowed [lindex $item_info 12]
+ set timelimitaction [lindex $item_info 13]
+ set datafromlms [lindex $item_info 14]
+ set masteryscore [lindex $item_info 15]
+ set isshared [lindex $item_info 16]
+ incr sort_order
+
+ # Now we have to create a new cr_item and revision for the ims_item_id
+ set new_ims_item_id [content::item::new \
+ -name $item_identifier \
+ -content_type "ims_item_object" \
+ -parent_id $items_parent_id \
+ -creation_date [dt_sysdate] \
+ -creation_user $user_id \
+ -creation_ip $creation_ip \
+ -context_id $package_id]
+
+ set new_ims_revision_id [content::revision::new \
+ -item_id $new_ims_item_id \
+ -title $item_identifier \
+ -description "Upgraded using lors" \
+ -creation_date [dt_sysdate] \
+ -creation_ip $creation_ip \
+ -creation_user $user_id \
+ -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_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
+ }
+ }; # 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 {
+ 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 drop_tables {
- drop table ims_cp_items_to_resources_copy
- }
- db_dml drop_tables {
- drop table ims_cp_items_copy
- }
- db_dml drop_tables {
- drop table ims_cp_files_copy
- }
- db_dml drop_tables {
- drop table ims_cp_resources_copy
- }
- db_dml drop_tables {
- drop table ims_cp_organizations_copy
- }
- db_dml drop_tables {
- drop table ims_cp_manifest_class_copy
- }
- db_dml drop_tables {
- drop table ims_cp_manifests_copy
- }
-
-# END ad_proc
-}
\ No newline at end of file
+
+ db_dml drop_tables {drop table ims_cp_items_to_resources_copy}
+
+ db_dml drop_tables {drop table ims_cp_items_copy}
+
+ db_dml drop_tables {drop table ims_cp_files_copy}
+
+ db_dml drop_tables {drop table ims_cp_resources_copy}
+
+ db_dml drop_tables {drop table ims_cp_organizations_copy}
+
+ db_dml drop_tables {drop table ims_cp_manifest_class_copy}
+
+ db_dml drop_tables {drop table ims_cp_manifests_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.2 -r1.3
--- openacs-4/packages/lors/tcl/lors-callback-procs.tcl 7 Jun 2006 13:45:20 -0000 1.2
+++ openacs-4/packages/lors/tcl/lors-callback-procs.tcl 17 Nov 2008 13:35:02 -0000 1.3
@@ -6,6 +6,7 @@
@cvs-id $Id$
}
+
ad_proc -public -callback lors::import {
-res_type
-res_href
@@ -22,48 +23,46 @@
#Callbacks for application-track
-ad_proc -callback application-track::getApplicationName -impl lorsm {} {
- callback implementation
- } {
- return "lorsm"
- }
-
-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
- }
-
- return "$result"
+ad_proc -callback application-track::getApplicationName -impl lorsm {} {
+ callback implementation
+} {
+ return "lorsm"
+}
+
+
+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
}
-ad_proc -callback application-track::getSpecificInfo -impl lorsm {} {
- callback implementation
- } {
-
- upvar $query_name my_query
- upvar $elements_name my_elements
+ return "$result"
+}
- set my_query {
- select d.id,i.course_name,l.start_time,l.end_time
- from lorsm_student_track l, dotlrn_users d, ims_cp_manifests i
- where l.course_id IN
- (
- select distinct l.course_id
- from lorsm_student_track l
- where l.community_id=:class_instance_id
- group by l.course_id)
- and l.user_id = d.user_id
- and l.course_id = i.man_id
- }
-
- set my_elements ""
- return "OK"
+ad_proc -callback application-track::getSpecificInfo -impl lorsm {} {
+ callback implementation
+} {
+ upvar $query_name my_query
+ upvar $elements_name my_elements
+
+ set my_query {
+ select d.id,i.course_name,l.start_time,l.end_time
+ from lorsm_student_track l, dotlrn_users d, ims_cp_manifests i
+ where l.course_id IN
+ (select distinct l.course_id
+ from lorsm_student_track l
+ where l.community_id=:class_instance_id
+ group by l.course_id)
+ and l.user_id = d.user_id
+ and l.course_id = i.man_id
}
-
\ No newline at end of file
+
+ set my_elements ""
+ return "OK"
+}
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.6 -r1.7
--- openacs-4/packages/lors/tcl/lors-cr-procs.tcl 7 Jun 2006 13:52:01 -0000 1.6
+++ openacs-4/packages/lors/tcl/lors-cr-procs.tcl 17 Nov 2008 13:35:02 -0000 1.7
@@ -1,6 +1,6 @@
ad_library {
-
+
@creation-date 2003-10-13
@author Ernie Ghiglione (ErnieG@mm.st)
@cvs-id $Id$
@@ -33,14 +33,14 @@
@param fs_dir File System directory
} {
set files [list]
- foreach f [glob -no complain [file join $fs_dir * ]] {
- set type [file type $f]
- switch $type {
- file {
- lappend files $f
- }
- }
- }
+ foreach f [glob -no complain [file join $fs_dir * ]] {
+ set type [file type $f]
+ switch $type {
+ file {
+ lappend files $f
+ }
+ }
+ }
return $files
}
@@ -55,14 +55,14 @@
@param fs_dir File System directory
} {
set directories [list]
- foreach dir [glob -no complain [file join $fs_dir * ]] {
- set type [file type $dir]
- switch $type {
- directory {
- lappend directories $dir
- }
- }
- }
+ foreach dir [glob -no complain [file join $fs_dir * ]] {
+ set type [file type $dir]
+ switch $type {
+ directory {
+ lappend directories $dir
+ }
+ }
+ }
return $directories
}
@@ -94,30 +94,32 @@
# regsub -all { +} [string tolower $folder_name] {_} name
#return [list $name $folder_name $parent_id $user_id $creation_ip]
+ # create the folder
-# db_transaction {
+ set folder_id [db_exec_plsql folder_create {
+ select lors__new_folder (:name, :folder_name, :parent_id, :user_id, :creation_ip);
+ }]
- # create the folder
+ content::folder::register_content_type \
+ -folder_id $folder_id \
+ -content_type "content_revision" \
+ -include_subtypes "t"
- 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_folder" \
+ -include_subtypes "t"
- 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"
+ content::folder::register_content_type \
+ -folder_id $folder_id \
+ -content_type "content_symlink" \
+ -include_subtypes "t"
-
-# } on_error {
-# ad_return_error "[_ lors.lt_Error_inserting_folde]" "[_ lors.The_error_was_errmsg]"
-# error "[_ lors.The_error_was_errmsg]"
-# ad_script_abort
-# }
+ content::folder::register_content_type \
+ -folder_id $folder_id \
+ -content_type "content_extlink" \
+ -include_subtypes "t"
+
return $folder_id
}
@@ -128,51 +130,60 @@
{-indb_p:required}
} {
Adds a bunch of files to a folder in the CR
- Returns a list with full_path_to_file, mime-type, parent_id,
+ Returns a list with full_path_to_file, mime-type, parent_id,
file_id, version_id, cr_file, file size.
@param parent_id Folder's parent_id where the files will be put
@param files All files for the parent_id folder come in one list
@param indb_p Whether this file-storage instance (we are about to use) stores files in the file system or in the db
-
+
} {
# Get the user
set user_id [ad_conn user_id]
-
+
# Get the ip
set creation_ip [ad_conn peeraddr]
set retlist [list]
foreach fle $files {
- regexp {[^//\\]+$} $fle filename
- set title $filename
+ regexp {[^//\\]+$} $fle filename
+ set title $filename
set mime_type [cr_filename_to_mime_type -create $fle]
# insert file into the CR
-# db_transaction {
- set description "uploaded using LORs"
+ set description "uploaded using LORs"
- # add file
- set file_id [content::item::new -name $title -parent_id $parent_id -creation_user $user_id \
- -creation_ip $creation_ip]
+ # add file
+ set file_id [content::item::new \
+ -name $title \
+ -parent_id $parent_id \
+ -creation_user $user_id \
+ -creation_ip $creation_ip]
- # add revision
- set version_id [content::revision::new -title $title -description $description -mime_type $mime_type \
- -creation_user $user_id -creation_ip $creation_ip -item_id $file_id -is_live "t"]
+ # add revision
+ set version_id [content::revision::new \
+ -title $title \
+ -description $description \
+ -mime_type $mime_type \
+ -creation_user $user_id \
+ -creation_ip $creation_ip \
+ -item_id $file_id \
+ -is_live "t"]
- # move the actual file into the CR
- set cr_file [cr_create_content_file $file_id $version_id $fle]
- # 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_revi "update cr_revisions set content = '$cr_file', content_length = $file_size where revision_id = :version_id"
+ # move the actual file into the CR
+ set cr_file [cr_create_content_file $file_id $version_id $fle]
-# }
+ # 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_revi \
+ "update cr_revisions set content = '$cr_file',
+ content_length = $file_size where revision_id = :version_id"
+
lappend retlist [list $fle $mime_type $parent_id $file_id $version_id $cr_file $file_size]
}
return $retlist
@@ -183,11 +194,12 @@
-name:required
-folder_id:required
} {
- Get the item_id of a file
+ Get the item_id of a file
} {
if {[empty_string_p $folder_id]} {
- set package_id [ad_conn package_id]
- set folder_id [fs_get_root_folder -package_id $package_id]
+ 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' )"]
-}
\ No newline at end of file
+ return [db_exec_plsql get_item_id \
+ "select content_item__get_id ( :name, :folder_id, 'f' )"]
+}
Index: openacs-4/packages/lors/tcl/lors-imscp-blackboard5-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-imscp-blackboard5-procs.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/lors/tcl/lors-imscp-blackboard5-procs.tcl 18 May 2005 17:13:55 -0000 1.5
+++ openacs-4/packages/lors/tcl/lors-imscp-blackboard5-procs.tcl 17 Nov 2008 13:35:03 -0000 1.6
@@ -69,7 +69,9 @@
if {![empty_string_p dates_node]} {
set created [$dates_node child all CREATED]
set updated [$dates_node child all UPDATED]
- return [list [lors::imsmd::getAtt $created value] [lors::imsmd::getAtt $updated value]]
+ return [list \
+ [lors::imsmd::getAtt $created value] \
+ [lors::imsmd::getAtt $updated value]]
} else {
return ""
}
@@ -107,7 +109,7 @@
@option name Name of the attribute to get
@option node XML node
-
+
@author Ernie Ghiglione (ErnieG@mm.st)
} {
set navigation [$node child all [string toupper NAVIGATION]]
@@ -158,7 +160,7 @@
ad_proc -public lors::imscp::bb::getUsers {
-file:required
} {
- Gets the Blackboard users from the XML resource file where the user info is.
+ Gets the Blackboard users from the XML resource file where the user info is.
Returns a list of user attributes
@option file File and filepath to XML file
@@ -171,42 +173,45 @@
set userlist [list]
set emails [list]
foreach user [$usersnode child all USER] {
-
set user_id [$user getAttribute id]
set login_id [[$user getElementsByTagName LOGINID] getAttribute value]
set passphrase [[$user getElementsByTagName PASSPHRASE] getAttribute value]
set last_names [[$user getElementsByTagName FAMILY] getAttribute value]
set first_names [[$user getElementsByTagName GIVEN] getAttribute value]
set email [[$user getElementsByTagName EMAIL] getAttribute value]
-# For testing purpose only... has to be removed later
-
+ # For testing purpose only... has to be removed later
set email $login_id@box.com
-#
-
set creation_date [[$user getElementsByTagName CREATED] getAttribute value]
set updated_date [[$user getElementsByTagName UPDATED] getAttribute value]
set active [[$user getElementsByTagName ISAVAILABLE] getAttribute value]
- set role_value [string tolower [[$user getElementsByTagName ROLE] getAttribute value]]
+ set role_value [string tolower [
+ [$user getElementsByTagName ROLE] getAttribute value]]
switch $role_value {
instructor {
set role "professor"
- }
- default {
+ } default {
set role "student"
}
}
- set role_description [[$user getElementsByTagName ROLE] getAttribute description]
-
- lappend userlist [list "user_id" $user_id "login_id" $login_id "passphrase" $passphrase "last_names" $last_names "first_names" $first_names "email" $email \
- "creation_date" $creation_date "updated_date" $updated_date "active" $active "role" $role "role_description" $role_description]
+ set role_description [
+ [$user getElementsByTagName ROLE] getAttribute description]
+ lappend userlist [list "user_id" $user_id \
+ "login_id" $login_id \
+ "passphrase" $passphrase \
+ "last_names" $last_names \
+ "first_names" $first_names \
+ "email" $email \
+ "creation_date" $creation_date \
+ "updated_date" $updated_date \
+ "active" $active \
+ "role" $role \
+ "role_description" $role_description]
}
-
return $userlist
-
}
Index: openacs-4/packages/lors/tcl/lors-imscp-blackboard6-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-imscp-blackboard6-procs.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/lors/tcl/lors-imscp-blackboard6-procs.tcl 18 May 2005 17:19:46 -0000 1.7
+++ openacs-4/packages/lors/tcl/lors-imscp-blackboard6-procs.tcl 17 Nov 2008 13:35:03 -0000 1.8
@@ -1,7 +1,7 @@
ad_library {
IMS Content Packaging functions
- for Blackboard 6
+ for Blackboard 6
@creation-date 2003-10-13
@author Ernie Ghiglione (ErnieG@mm.st)
@@ -40,12 +40,12 @@
@author Ernie Ghiglione (ErnieG@mm.st)
} {
- return [file exists $tmp_dir/.bb-package-info]
+ return [file exists $tmp_dir/.bb-package-info]
}
ad_proc -public lors::imscp::bb6::getItems {
- {tree}
+ {tree}
{parent ""}
} {
Extracts data from Items
@@ -59,36 +59,32 @@
set itemx [$tree child all item]
if { ![empty_string_p $itemx] } {
-
if {[empty_string_p $parent]} {
set parent 0
}
- set it_list ""
+ set it_list ""
foreach itemx [$tree child all item] {
-
set cc ""
- #{$parent}"
+
# gets item identifier
set cc "[lors::imsmd::getAtt $itemx identifier]"
# gets item identifierref
set cc [concat $cc "[lors::imsmd::getAtt $itemx identifierref]"]
- # gets xml node
- set cc [concat $cc $itemx]
+ # gets xml node
+ set cc [concat $cc $itemx]
+ set it_list [concat $it_list [list $cc]]
- set it_list [concat $it_list [list $cc]]
-
set itemxx [$itemx child all item]
if { ![empty_string_p $itemxx] } {
- set it_list [concat $it_list [getItems $itemx]]
- }
+ set it_list [concat $it_list [getItems $itemx]]
+ }
set items [concat $items $cc]
}
}
return $it_list
- #$items
}
@@ -109,6 +105,7 @@
}
}
+
ad_proc -public lors::imscp::bb6::getDescription {
-node:required
} {
@@ -138,7 +135,8 @@
if {![empty_string_p dates_node]} {
set created [$dates_node child all CREATED]
set updated [$dates_node child all UPDATED]
- return [list [lors::imsmd::getAtt $created value] [lors::imsmd::getAtt $updated value]]
+ return [list \
+ [lors::imsmd::getAtt $created value] [lors::imsmd::getAtt $updated value]]
} else {
return ""
}
@@ -163,7 +161,6 @@
} else {
return ""
}
-
} else {
return ""
}
@@ -176,7 +173,7 @@
@option name Name of the attribute to get
@option node XML node
-
+
@author Ernie Ghiglione (ErnieG@mm.st)
} {
set navigation [$node child all [string toupper NAVIGATION]]
@@ -212,7 +209,7 @@
# coursetoc
set coursetoc [$doc documentElement]
- set list_items [list]
+ set list_items [list]
# gets coursetoc elements and values
lappend list_items {id} [lors::imsmd::getAtt $coursetoc id]
@@ -231,7 +228,6 @@
# return list
return $list_items
-
}
@@ -245,11 +241,11 @@
} {
# open xml file
set doc [dom parse [::tDOM::xmlReadFile $file]]
+
# content
set content [$doc documentElement]
+ set list_items [list]
- set list_items [list]
-
# gets content elements and values
lappend list_items {id} [lors::imsmd::getAtt $content id]
lappend list_items {TITLE} [lors::imsmd::getAtt [$content getElementsByTagName TITLE] value]
@@ -275,28 +271,22 @@
set files [list]
foreach file [[$content selectNodes /CONTENT/FILES] childNodes] {
+ set file_list [list]
+ lappend file_list {file_id} [lors::imsmd::getAtt $file id]
+ lappend file_list {NAME} [lors::imsmd::getElement [$file getElementsByTagName NAME]]
+ lappend file_list {FILEACTION} [lors::imsmd::getAtt [$file getElementsByTagName FILEACTION] value]
+ lappend file_list {LINKNAME} [lors::imsmd::getAtt [$file getElementsByTagName LINKNAME] value]
+ lappend file_list {SIZE} [lors::imsmd::getAtt [$file getElementsByTagName SIZE] value]
+ lappend file_list {CREATED} [lors::imsmd::getAtt [$file getElementsByTagName CREATED] value]
+ lappend file_list {UPDATED} [lors::imsmd::getAtt [$file getElementsByTagName UPDATED] value]
- set file_list [list]
- lappend file_list {file_id} [lors::imsmd::getAtt $file id]
- lappend file_list {NAME} [lors::imsmd::getElement [$file getElementsByTagName NAME]]
- lappend file_list {FILEACTION} [lors::imsmd::getAtt [$file getElementsByTagName FILEACTION] value]
- lappend file_list {LINKNAME} [lors::imsmd::getAtt [$file getElementsByTagName LINKNAME] value]
- lappend file_list {SIZE} [lors::imsmd::getAtt [$file getElementsByTagName SIZE] value]
- lappend file_list {CREATED} [lors::imsmd::getAtt [$file getElementsByTagName CREATED] value]
- lappend file_list {UPDATED} [lors::imsmd::getAtt [$file getElementsByTagName UPDATED] value]
+ foreach registryentry [[$file getElementsByTagName REGISTRY] childNodes] {
+ if {[$registryentry getAttribute key] == "entry_point"} {
+ lappend file_list {REGISTRY_ENTRY_POINT} [lors::imsmd::getAtt $registryentry value]
+ }
+ }
- foreach registryentry [[$file getElementsByTagName REGISTRY] childNodes] {
-
- if {[$registryentry getAttribute key] == "entry_point"} {
-
- lappend file_list {REGISTRY_ENTRY_POINT} [lors::imsmd::getAtt $registryentry value]
-
- }
-
- }
-
- lappend files $file_list
-
+ lappend files $file_list
}
lappend list_items {FILES} $files
@@ -325,27 +315,26 @@
# check if directory exists
if { ![file exists $dirname] } {
- # create dir
- file mkdir $dirname
+ file mkdir $dirname
}
# transforms text into html
if {[lors::imscp::bb6::looks_like_html_p -text $txt]} {
-# set txt [ad_text_to_html -includes_html $txt]
+ # set txt [ad_text_to_html -includes_html $txt]
} else {
- set txt [ad_text_to_html -includes_html $txt]
-# set txt [ad_html_text_convert -from "text/plain" -to "text/html" $txt]
+ set txt [ad_text_to_html -includes_html $txt]
+ # set txt [ad_html_text_convert -from "text/plain" -to "text/html" $txt]
}
# saves it on a new html file
set f_handler [open $filename w+]
fconfigure $f_handler -encoding utf-8
- puts -nonewline $f_handler " \ $txt \"
+ puts -nonewline $f_handler " \ $txt \"
close $f_handler
# returns what is is an href for resources
return $filename
-
}
@@ -360,10 +349,12 @@
@author Ernie Ghiglione (ErnieG@mm.st)
} {
- if { [regexp -nocase {} $text] || [regexp -nocase {
} $text] || [regexp -nocase {} $text] || [regexp -nocase {