Index: openacs-4/packages/imsld/tcl/imsld-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-install-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 5 Oct 2005 17:52:44 -0000 1.10 +++ openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 3 Nov 2005 17:50:08 -0000 1.11 @@ -93,18 +93,21 @@ content::type::attribute::new -content_type imsld_learning_activity -attribute_name parameters -datatype string -pretty_name "#imsld.Parameters#" -column_spec "varchar(4000)" content::type::attribute::new -content_type imsld_learning_activity -attribute_name learning_objective_id -datatype number -pretty_name "#imsld.lt_Learning_Objective_ID#" -column_spec "integer" content::type::attribute::new -content_type imsld_learning_activity -attribute_name prerequisite_id -datatype number -pretty_name "#imsld.Prerequistes_ID#" -column_spec "integer" + content::type::attribute::new -content_type imsld_learning_activity -attribute_name sort_order -datatype number -pretty_name "<#_ Sort Order #>" -column_spec "integer" # support activities content::type::new -content_type imsld_support_activity -supertype content_revision -pretty_name "#imsld.lt_IMS-LD_Support_Activi#" -pretty_plural "#imsld.lt_IMS-LD_Support_Activi_1#" -table_name imsld_support_activities -id_column activity_id content::type::attribute::new -content_type imsld_support_activity -attribute_name identifier -datatype string -pretty_name "#imsld.Identifier#" -column_spec "varchar(100)" content::type::attribute::new -content_type imsld_support_activity -attribute_name component_id -datatype number -pretty_name "#imsld.Component_Identifier#" -column_spec "integer" + content::type::attribute::new -content_type imsld_support_activity -attribute_name activity_description_id -datatype number -pretty_name "#imsld.lt_Activity_Description_#" -column_spec "integer" content::type::attribute::new -content_type imsld_support_activity -attribute_name parameter_id -datatype number -pretty_name "#imsld.Parameter_Identifier#" -column_spec "integer" content::type::attribute::new -content_type imsld_support_activity -attribute_name is_visible_p -datatype string -pretty_name "#imsld.Is_Visible#" -column_spec "char(1)" content::type::attribute::new -content_type imsld_support_activity -attribute_name user_choice_p -datatype string -pretty_name "#imsld.User_Choice#" -column_spec "char(1)" content::type::attribute::new -content_type imsld_support_activity -attribute_name time_limit_id -datatype number -pretty_name "#imsld.lt_Time_Limit_Identifier#" -column_spec "integer" content::type::attribute::new -content_type imsld_support_activity -attribute_name on_completion_id -datatype number -pretty_name "#imsld.lt_On_Completion_Identif#" -column_spec "integer" content::type::attribute::new -content_type imsld_support_activity -attribute_name parameters -datatype string -pretty_name "#imsld.Parameters#" -column_spec "varchar(4000)" + content::type::attribute::new -content_type imsld_support_activity -attribute_name sort_order -datatype number -pretty_name "<#_ Sort Order #>" -column_spec "integer" # activity structures content::type::new -content_type imsld_activity_structure -supertype content_revision -pretty_name "#imsld.lt_IMS-LD_Activity_Struc#" -pretty_plural "#imsld.lt_IMS-LD_Activity_Struc_1#" -table_name imsld_activity_structures -id_column structure_id @@ -114,6 +117,7 @@ content::type::attribute::new -content_type imsld_activity_structure -attribute_name number_to_select -datatype number -pretty_name "#imsld.Number_to_Select#" -column_spec "integer" content::type::attribute::new -content_type imsld_activity_structure -attribute_name structure_type -datatype string -pretty_name "#imsld.Structure_Type#" -column_spec "char(9)" content::type::attribute::new -content_type imsld_activity_structure -attribute_name sort -datatype string -pretty_name "#imsld.Sort#" -column_spec "varchar(4)" + content::type::attribute::new -content_type imsld_activity_structure -attribute_name sort_order -datatype number -pretty_name "<#_ Sort Order #>" -column_spec "integer" # environments content::type::new -content_type imsld_environment -supertype content_revision -pretty_name "#imsld.IMD-LD_Environment#" -pretty_plural "#imsld.IMD-LD_Environments#" -table_name imsld_environments -id_column environment_id @@ -458,23 +462,27 @@ content::type::attribute::delete -content_type imsld_learning_activity -attribute_name parameters content::type::attribute::delete -content_type imsld_learning_activity -attribute_name learning_objective_id content::type::attribute::delete -content_type imsld_learning_activity -attribute_name prerequisite_id + content::type::attribute::delete -content_type imsld_learning_activity -attribute_name sort_order # support activities content::type::attribute::delete -content_type imsld_support_activity -attribute_name identifier content::type::attribute::delete -content_type imsld_support_activity -attribute_name component_id + content::type::attribute::delete -content_type imsld_support_activity -attribute_name activity_description_id content::type::attribute::delete -content_type imsld_support_activity -attribute_name parameter_id content::type::attribute::delete -content_type imsld_support_activity -attribute_name is_visible_p content::type::attribute::delete -content_type imsld_support_activity -attribute_name user_choice_p content::type::attribute::delete -content_type imsld_support_activity -attribute_name time_limit_id content::type::attribute::delete -content_type imsld_support_activity -attribute_name on_completion_id content::type::attribute::delete -content_type imsld_support_activity -attribute_name parameters + content::type::attribute::delete -content_type imsld_support_activity -attribute_name sort_order # activity structures content::type::attribute::delete -content_type imsld_activity_structure -attribute_name component_id content::type::attribute::delete -content_type imsld_activity_structure -attribute_name identifier content::type::attribute::delete -content_type imsld_activity_structure -attribute_name number_to_select content::type::attribute::delete -content_type imsld_activity_structure -attribute_name structure_type content::type::attribute::delete -content_type imsld_activity_structure -attribute_name sort + content::type::attribute::delete -content_type imsld_activity_structure -attribute_name sort_order # environments content::type::attribute::delete -content_type imsld_environment -attribute_name component_id Index: openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 5 Oct 2005 15:33:25 -0000 1.10 +++ openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 3 Nov 2005 17:50:08 -0000 1.11 @@ -1713,14 +1713,17 @@ relation_add imsld_as_info_i_rel $activity_structure_id $information_id } - # Activity Structure: Environments - set environment_refs [$activity_node child all imsld:environment-ref] - if { [llength $environment_refs] } { - foreach environment_ref_node $environment_refs { + # store the order of the activities to display them later in the correct order + set sort_order 0 + foreach node_ref [$activity_node childNodes] { + + # Activity Structure: Environments + set environment_refs [$activity_node child all imsld:environment-ref] + if { [string eq [$node_ref nodeName] imsld:environment-ref] } { # the environments have been already parsed by now, # so the referenced environment has to be in the database. # If not found, return the error - set environment_ref [string tolower [imsld::parse::get_attribute -node $environment_ref_node -attr_name ref]] + set environment_ref [string tolower [imsld::parse::get_attribute -node $node_ref -attr_name ref]] if { ![db_0or1row get_environment_id { select item_id as environment_id from imsld_environmentsi @@ -1731,38 +1734,37 @@ # error, referenced environment does not exist return [list 0 "[_ imsld.lt_Referenced_environmen_3]"] } - + # map environment with activity structure relation_add imsld_as_env_rel $activity_structure_id $environment_id } - } - - # Activity Structure: Learning Activities ref - set learning_activity_ref_nodes [$activity_node child all imsld:learning-activity-ref] - if { [llength $learning_activity_ref_nodes] } { - foreach learning_activity_ref_node $learning_activity_ref_nodes { - + + # Activity Structure: Learning Activities ref + if { [string eq [$node_ref nodeName] imsld:learning-activity-ref] } { # the learning activities have been already parsed by now, so the referenced learning activity has to be in the database. # If not, return the error - set learning_activity_ref [string tolower [imsld::parse::get_attribute -node $learning_activity_ref_node -attr_name ref]] + set learning_activity_ref [string tolower [imsld::parse::get_attribute -node $node_ref -attr_name ref]] if { ![db_0or1row get_learning_activity_id { - select item_id as activity_id + select item_id as activity_id, + activity_id as learning_activity_id from imsld_learning_activitiesi where identifier = :learning_activity_ref and content_revision__is_live(activity_id) = 't' and component_id = :component_id }] } { # may be the reference is wrong, search in the support activityes before returning an error if { ![db_0or1row get_learning_support_activity_id { - select item_id as activity_id + select item_id as activity_id, + activity_id as support_activity_id from imsld_support_activitiesi where identifier = :learning_activity_ref and content_revision__is_live(activity_id) = 't' and component_id = :component_id }] } { # ok, last try: searching in the rest of activity structures... if { [db_0or1row get_struct_id { - select item_id as refrenced_struct_id + select item_id as refrenced_struct_id, + structure_id from imsld_activity_structuresi where identifier = :learning_activity_ref and content_revision__is_live(structure_id) = 't' @@ -1773,6 +1775,13 @@ append warnings "