Index: openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml,v diff -u -r1.24 -r1.25 --- openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml 10 Jul 2006 13:15:13 -0000 1.24 +++ openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml 13 Jul 2006 13:11:43 -0000 1.25 @@ -48,6 +48,8 @@ IMS-LD IMS-LD Act IMS-LD Acts + IMS-LD Class + IMS-LD Classes IMS-LD Component IMS-LD Components IMS-LD Condition @@ -130,6 +132,7 @@ IMS-LD Activity Descriptions IMS-LD Activity Structure IMS-LD Activity Structures + IMS-LD Class Ideintifier IMS-LD Conference Service IMS-LD Conference Services IMS-LD CP Dependencies Index: openacs-4/packages/imsld/sql/postgresql/imsld-level-a-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-level-a-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/sql/postgresql/imsld-level-a-create.sql 29 May 2006 15:10:52 -0000 1.4 +++ openacs-4/packages/imsld/sql/postgresql/imsld-level-a-create.sql 13 Jul 2006 13:11:43 -0000 1.5 @@ -689,6 +689,24 @@ Feedback are items that are mapped to this table with the imsld_feedback_rel.'; +create table imsld_classes ( + class_id integer + constraint imsld_cla_fk + references cr_revisions + on delete cascade + constraint imsld_cla_pk + primary key, + method_id integer + constraint imsld_cla_methodid_fk + references cr_items, --imsld_methods + identifier varchar(200) +); + +comment on table imsld_classes is ' +Classes (global elements) which are referenced trough the imsld-content resources, and which visibility may be modified in the conditions.'; + +-- Rel Tables + create table imsld_as_la_rels ( rel_id integer constraint imsld_as_la_rels_fk Index: openacs-4/packages/imsld/sql/postgresql/imsld-level-a-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-level-a-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/imsld/sql/postgresql/imsld-level-a-drop.sql 29 May 2006 15:10:52 -0000 1.2 +++ openacs-4/packages/imsld/sql/postgresql/imsld-level-a-drop.sql 13 Jul 2006 13:11:43 -0000 1.3 @@ -51,4 +51,6 @@ drop table imsld_on_completion cascade; +drop table imsld_classes cascade; + drop table imsld_res_files_rel cascade; \ No newline at end of file Index: openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl 10 Jul 2006 13:15:13 -0000 1.10 +++ openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl 13 Jul 2006 13:11:43 -0000 1.11 @@ -209,15 +209,15 @@ } {less-than} { - set propertyref [$expressionNode selectNodes {*[local-name()='property-ref']}] - set propertyvalue0 [imsld::runtime::property::property_value_get -run_id $run_id -user_id $user_id -identifier [$propertyref getAttribute {ref}]] - set propertyvalue1 [[$expressionNode selectNodes {*[local-name()='property-value']}] text] + set childs [$expressionNode childNodes] + set propertyvalue0 [imsld::expression::eval -run_id $run_id -expression [lindex $childs 0]] + set propertyvalue1 [imsld::expression::eval -run_id $run_id -expression [lindex $childs 1]] return [expr {$propertyvalue0 < $propertyvalue1}] } {greater-than} { - set propertyref [$expressionNode selectNodes {*[local-name()='property-ref']}] - set propertyvalue0 [imsld::runtime::property::property_value_get -run_id $run_id -user_id $user_id -identifier [$propertyref getAttribute {ref}]] - set propertyvalue1 [[$expressionNode selectNodes {*[local-name()='property-value']}] text] + set childs [$expressionNode childNodes] + set propertyvalue0 [imsld::expression::eval -run_id $run_id -expression [lindex $childs 0]] + set propertyvalue1 [imsld::expression::eval -run_id $run_id -expression [lindex $childs 1]] return [expr {$propertyvalue0 > $propertyvalue1}] } {divide} { @@ -264,15 +264,15 @@ return $returnvalue } {is-not} { - set propertyref [$expressionNode selectNodes {*[local-name()='property-ref']}] - set propertyvalue0 [imsld::runtime::property::property_value_get -run_id $run_id -user_id $user_id -identifier [$propertyref getAttribute {ref}]] - set propertyvalue1 [[$expressionNode selectNodes {*[local-name()='property-value']}] text] + set childs [$expressionNode childNodes] + set propertyvalue0 [imsld::expression::eval -run_id $run_id -expression [lindex $childs 0]] + set propertyvalue1 [imsld::expression::eval -run_id $run_id -expression [lindex $childs 1]] return [expr {$propertyvalue0 != $propertyvalue1}] } {is} { - set propertyref [$expressionNode selectNodes {*[local-name()='property-ref']}] - set propertyvalue0 [imsld::runtime::property::property_value_get -run_id $run_id -user_id $user_id -identifier [$propertyref getAttribute {ref}]] - set propertyvalue1 [[$expressionNode selectNodes {*[local-name()='property-value']}] text] + set childs [$expressionNode childNodes] + set propertyvalue0 [imsld::expression::eval -run_id $run_id -expression [lindex $childs 0]] + set propertyvalue1 [imsld::expression::eval -run_id $run_id -expression [lindex $childs 1]] return [expr {$propertyvalue0 == $propertyvalue1}] } {is-member-of-role} { 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.30 -r1.31 --- openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 10 Jul 2006 13:45:29 -0000 1.30 +++ openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 13 Jul 2006 13:11:43 -0000 1.31 @@ -207,6 +207,12 @@ content::type::attribute::new -content_type imsld_on_completion -attribute_name feedback_title -datatype string -pretty_name "#imsld.Feedbach_Title#" -column_spec "varchar(200)" + # classes + content::type::new -content_type imsld_class -supertype content_revision -pretty_name "#imsld.IMS-LD_Class#" -pretty_plural "#imsld.IMS-LD_Classes#" -table_name imsld_classes -id_column class_id + + content::type::attribute::new -content_type imsld_class -attribute_name method_id -datatype number -pretty_name "#imsld.Method_Identifier#" -column_spec "integer" + content::type::attribute::new -content_type imsld_class -attribute_name identifier -datatype string -pretty_name "#imsld.lt_IMS-LD_Class_Ideintif#" -column_spec "varchar(200)" + ### IMS-LD Content Packaging # manifests @@ -244,6 +250,7 @@ content::type::attribute::new -content_type imsld_cp_file -attribute_name file_name -datatype string -pretty_name "#imsld.File_name#" -column_spec "varchar(2000)" content::type::attribute::new -content_type imsld_cp_file -attribute_name href -datatype string -pretty_name "#imsld.Href#" -column_spec "varchar(2000)" + ### IMS-LD LEVEL B # properties @@ -762,7 +769,11 @@ # on completion content::type::attribute::delete -content_type imsld_on_completion -attribute_name feedback_title - + + # classes + content::type::attribute::delete -content_type imsld_class -attribute_name method_id + content::type::attribute::delete -content_type imsld_class -attribute_name identifier + ### IMS-LD Content Packaging # manifests @@ -834,6 +845,7 @@ content::type::delete -content_type imsld_role_part -drop_table_p t content::type::delete -content_type imsld_complete_act -drop_table_p t content::type::delete -content_type imsld_on_completion -drop_table_p t + content::type::delete -content_type imsld_class -drop_table_p t ### IMS-LD Content Packaging content::type::delete -content_type imsld_cp_manifest -drop_table_p t Index: openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl 10 Jul 2006 13:15:13 -0000 1.6 +++ openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl 13 Jul 2006 13:11:43 -0000 1.7 @@ -181,7 +181,8 @@ # not instantiated... is it already defined (existing href)? or must we use the one of the global definition? if { ![string eq $existing_href ""] } { # it is already defined - # NOTE: there must be a better way to deal with this, but by the moment we treat the href as the property value + # NOTE: there must be a better way to deal with this, + # but by the moment we treat the href as the property value set initial_value $existing_href } # TODO: the property must be somehow instantiated in the given URI also @@ -233,7 +234,6 @@ from the possible changed values of a previous run. } { db_1row context_info { - select ic.item_id as component_item_id, ii.imsld_id, ii.learning_objective_id as imsld_learning_objective_id, @@ -248,9 +248,10 @@ and ir.run_id = :run_id } - # 1.1. items --> learning objectives, prerequisites, roles, learning objects, activity description, information(activity structures) + # 1. items --> learning objectives, prerequisites, roles, + # learning objects, activity description, information(activity structures) - # 1.1.1 learning objectives items + # 1.1 learning objectives items set linear_item_list [db_list item_in_imsld_loi { select ii.imsld_item_id from acs_rels ar, imsld_itemsi ii, imsld_learning_objectivesi lo @@ -268,7 +269,7 @@ and ia.component_id = :component_item_id }]] - # 1.1.2. prerequisites + # 1.2. prerequisites set linear_item_list [concat $linear_item_list [db_list item_in_imsld_pre { select ii.imsld_item_id from acs_rels ar, imsld_itemsi ii, imsld_prerequisitesi pre @@ -286,7 +287,7 @@ and ia.component_id = :component_item_id }]] - # 1.1.3. roles + # 1.3. roles set linear_item_list [concat $linear_item_list [db_list item_in_role { select ii.imsld_item_id from acs_rels ar, imsld_itemsi ii, imsld_rolesi ir @@ -295,7 +296,7 @@ and ir.component_id = :component_item_id }]] - # 1.1.4. learning objects (environments) + # 1.4. learning objects (environments) set linear_item_list [concat $linear_item_list [db_list item_in_lo { select ii.imsld_item_id from acs_rels ar, imsld_itemsi ii, imsld_learning_objectsi lo, imsld_environmentsi env @@ -305,7 +306,7 @@ and env.component_id = :component_item_id }]] - # 1.1.5. activity description (learning activities) + # 1.5. activity description (learning activities) set linear_item_list [concat $linear_item_list [db_list item_in_la_desc { select ii.imsld_item_id from acs_rels ar, imsld_itemsi ii, imsld_learning_activitiesi la, imsld_activity_descsi ad @@ -315,7 +316,7 @@ and la.component_id = :component_item_id }]] - # 1.1.5. activity description (support activities) + # 1.6. activity description (support activities) set linear_item_list [concat $linear_item_list [db_list item_in_sa_desc { select ii.imsld_item_id from acs_rels ar, imsld_itemsi ii, imsld_support_activitiesi sa, imsld_activity_descsi ad @@ -325,7 +326,7 @@ and sa.component_id = :component_item_id }]] - # 1.1.6. information(activity structures) + # 1.7. information(activity structures) set linear_item_list [concat $linear_item_list [db_list item_in_as_info { select ii.imsld_item_id from acs_rels ar, imsld_itemsi ii, imsld_activity_structuresi ast @@ -356,7 +357,7 @@ } } - # 1.2. learning activities + # 2. learning activities db_foreach learning_activity { select la.activity_id, coalesce(la.is_visible_p, 't') as is_visible_p, @@ -375,7 +376,7 @@ } } - # 1.3. support activities + # 3. support activities db_foreach support_activity { select sa.activity_id, coalesce(sa.is_visible_p, 't') as is_visible_p, @@ -394,7 +395,7 @@ } } - # 1.4. learning object (environment) + # 4. learning object (environment) db_foreach learning_object { select lo.learning_object_id, coalesce(lo.is_visible_p, 't') as is_visible_p, @@ -420,11 +421,11 @@ and type = 'class' and identifier = :class }] } { - set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id ""] [list type "class"] [list identifier $class] [list run_id $run_id] [list is_visible_p "t"] [list title ""] [list with_control_p ""]] imsld_attribute_instance new] + set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id ""] [list type "class"] [list identifier $class] [list run_id $run_id] [list is_visible_p "f"] [list title ""] [list with_control_p ""]] imsld_attribute_instance new] } } - # 1.5. service (enviroment) + # 5. service (enviroment) db_foreach service { select serv.service_id, coalesce(serv.is_visible_p, 't') as is_visible_p, @@ -450,11 +451,11 @@ and type = 'class' and identifier = :class }] } { - set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id ""] [list type "class"] [list identifier $class] [list run_id $run_id] [list is_visible_p "t"] [list title ""] [list with_control_p ""]] imsld_attribute_instance new] + set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id ""] [list type "class"] [list identifier $class] [list run_id $run_id] [list is_visible_p "f"] [list title ""] [list with_control_p ""]] imsld_attribute_instance new] } } - # 1.6. play + # 6. play db_foreach play { select play.play_id, coalesce(play.is_visible_p, 't') as is_visible_p, @@ -474,6 +475,23 @@ } } + # 7. classes + db_foreach class { + select cla.class_id, + cla.identifier + from imsld_classes cla, imsld_methodsi im + where cla.method_id = im.item_id + and im.imsld_id = :run_imsld_item_id + } { + if { ![db_0or1row already_instantiated { + select 1 from imsld_attribute_instances + where identifier = :identifier + and run_id = :run_id + }] } { + set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id ""] [list type "class"] [list identifier $identifier] [list run_id $run_id] [list is_visible_p "f"] [list title ""] [list with_control_p ""]] imsld_attribute_instance new] + } + } + return } 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.51 -r1.52 --- openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 11 Jul 2006 08:45:05 -0000 1.51 +++ openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 13 Jul 2006 13:11:43 -0000 1.52 @@ -3546,24 +3546,45 @@ if { [llength $then_node] != 1 } { return 0 } - $temporal_node appendChild $then_node + set then_temporal_node [$then_node cloneNode -deep] + $temporal_node appendChild $then_temporal_node set else_node [$condition_node selectNodes { following-sibling::*[local-name()='else' and position()=1] } ] if { [llength $else_node] == 1 } { - $temporal_node appendChild $else_node + set else_temporal_node [$else_node cloneNode -deep] + $temporal_node appendChild $else_temporal_node } elseif { [llength $else_node] > 1 } { return 0 } set xml_piece [$temporal_node asXML] - + set if_then_else_id [imsld::item_revision_new -attributes [list [list method_id $method_id] \ - [list condition_xml $xml_piece]] \ - -content_type imsld_condition \ - -parent_id $parent_id] + [list condition_xml $xml_piece]] \ + -content_type imsld_condition \ + -parent_id $parent_id] return $if_then_else_id - } +ad_proc -public imsld::parse::parse_and_create_class { + -class_node + -parent_id + -method_id +} { + Parse a class and stores all the information in the database. + + Returns the class_id (item_id) if there were no errors, or 0 and an explanation messge if there was an error. + + @param method_id + @param class_node + @param parent_id Parent folder ID +} { + set class_identifier [imsld::parse::get_attribute -node $class_node -attr_name class] + set class_id [imsld::item_revision_new -attributes [list [list identifier $class_identifier] \ + [list method_id $method_id]] \ + -content_type imsld_class \ + -parent_id $parent_id] +} + ad_proc -public imsld::parse::parse_and_create_calculate { -calculate_node -manifest @@ -3987,7 +4008,7 @@ relation_add imsld_mp_completed_rel $method_id $play_id } } - + # Method: Conditions set conditions_list [$method selectNodes "*\[local-name()='conditions'\]"] foreach conditions $conditions_list { @@ -4012,6 +4033,21 @@ } } + # Classes: since the class elements are 'global-elements', we have to searh for the class elements + # through the entire manifest. + # NOTE: The classes are initialized to "is-visible = false" + set classes [$method selectNodes "//*\[local-name()='class'\]"] + foreach class_node $classes { + # Check the base URI + set class_identifier [imsld::parse::get_attribute -node $class_node -attr_name class] + if { [string eq [$class_node namespaceURI] [imsld::parse::get_URI -type "imsld"]] && ![db_0or1row class_created_p { *SQL* }] } { + # it's an ims-ld class, store it + set class_id [imsld::parse::parse_and_create_class -class_node $class_node \ + -method_id $method_id \ + -parent_id $cr_folder_id] + } + } + # Resources # look for the resource in the manifest and add it to the CR set manifest_resources_list [$manifest selectNodes {*[local-name()='resources']}] Index: openacs-4/packages/imsld/tcl/imsld-parse-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-parse-procs.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/tcl/imsld-parse-procs.xql 22 Feb 2006 16:09:39 -0000 1.4 +++ openacs-4/packages/imsld/tcl/imsld-parse-procs.xql 13 Jul 2006 13:11:43 -0000 1.5 @@ -443,5 +443,16 @@ + + + + + select 1 from imsld_classes + where identifier = :class_identifier + and method_id = :method_id + + + + Index: openacs-4/packages/imsld/tcl/imsld-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs.tcl,v diff -u -r1.76 -r1.77 --- openacs-4/packages/imsld/tcl/imsld-procs.tcl 12 Jul 2006 10:21:55 -0000 1.76 +++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 13 Jul 2006 13:11:43 -0000 1.77 @@ -647,8 +647,9 @@ if { [info exists table_name] } { if { [db_0or1row get_related_on_completion_id ""] } { - db_1row get_related_resource_id { *SQL* } - imsld::grant_permissions -resources_activities_list $related_resource -user_id $user_id + if { [db_0or1row get_related_resource_id { *SQL* }] } { + imsld::grant_permissions -resources_activities_list $related_resource -user_id $user_id + } } } if { [string eq $type "learning"] || [string eq $type "support"] || [string eq $type "structure"] } { Index: openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl 10 Jul 2006 14:41:56 -0000 1.10 +++ openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl 13 Jul 2006 13:11:43 -0000 1.11 @@ -326,7 +326,7 @@ } { Returns the role_id which has a given ref in a run, 0 if no matches found. } { - if{[db_0or1row select_role_id { + if { [db_0or1row select_role_id { select ar1.object_id_one as role_id from imsld_rolesi iri, acs_rels ar1, @@ -337,8 +337,8 @@ and ar2.object_id_two=:run_id and iri.item_id=ar1.object_id_one and iri.identifier=:ref - group by role_id; - }]} { + group by ar1.object_id_one; + }] } { return $role_id } else { return 0 Index: openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl 10 Jul 2006 13:15:14 -0000 1.8 +++ openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl 13 Jul 2006 13:11:43 -0000 1.9 @@ -298,7 +298,7 @@ env.item_id as environment_item_id, comp.component_id, comp.item_id as component_item_id - from imsld_runs ir, imsld_componentsi comp, imsld_environmentsi env, imsld_imsldsi + from imsld_runs ir, imsld_componentsi comp, imsld_environmentsi env, imsld_imsldsi ii where ir.run_id = :run_id and ir.imsld_id = ii.imsld_id and ii.item_id = comp.imsld_id Index: openacs-4/packages/imsld/www/imsld-content-serve.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-content-serve.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/www/imsld-content-serve.tcl 10 Jul 2006 13:15:14 -0000 1.4 +++ openacs-4/packages/imsld/www/imsld-content-serve.tcl 13 Jul 2006 13:11:44 -0000 1.5 @@ -380,7 +380,8 @@ prop.datatype, coalesce(ins.value, prop.initial_value) as value, prop.title, - prop.identifier + prop.identifier, + ins.instance_id from imsld_propertiesi prop, imsld_property_instances ins, acs_rels map @@ -401,6 +402,7 @@ set value [lindex $properties_in_group 3] set title [lindex $properties_in_group 4] set identifier [lindex $properties_in_group 5] + set instance_id [lindex $properties_in_group 6] # get the restrictions and translate them to HTML # currently, in HTML we can only deal with the restriction types: length, # maxlength, enumeration and totaldigits. Index: openacs-4/packages/imsld/www/imsld-finish-resource.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-finish-resource.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/imsld/www/imsld-finish-resource.tcl 20 Jun 2006 19:20:38 -0000 1.6 +++ openacs-4/packages/imsld/www/imsld-finish-resource.tcl 13 Jul 2006 13:11:44 -0000 1.7 @@ -22,4 +22,7 @@ }] } { imsld::finish_resource -resource_id $resource_id -run_id $run_id } -ad_returnredirect "[export_vars -base "$file_url" -url { file_url run_id resource_id resource_item_id owner_user_id }]" +if { ![regexp {http://} $file_url] } { + ad_returnredirect "[export_vars -base "$file_url" -url { file_url run_id resource_id resource_item_id owner_user_id }]" +} +ad_returnredirect "[export_vars -base "$file_url"]" Index: openacs-4/packages/imsld/www/monitor-frame.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/monitor-frame.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/www/monitor-frame.adp 20 Jun 2006 19:20:38 -0000 1.1 +++ openacs-4/packages/imsld/www/monitor-frame.adp 13 Jul 2006 13:11:44 -0000 1.2 @@ -20,7 +20,7 @@ - +