Index: openacs-4/packages/imsld/tcl/apm-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/apm-callback-procs.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/imsld/tcl/apm-callback-procs.tcl 13 Nov 2008 23:59:08 -0000 1.10
+++ openacs-4/packages/imsld/tcl/apm-callback-procs.tcl 18 Dec 2008 19:12:12 -0000 1.11
@@ -90,5 +90,11 @@
-attribute_name time_string -datatype string \
-pretty_name "#imsld.Time_String#" -column_spec "varchar(30)"
}
+ 1.5d 1.6d {
+ content::type::attribute::new -content_type imsld_imsld \
+ -attribute_name resource_handler -datatype string \
+ -pretty_name "#imsld.Resource_Handler#" -column_spec "varchar(100)"
+ }
}
+
}
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.46 -r1.47
--- openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 13 Nov 2008 23:59:08 -0000 1.46
+++ openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 18 Dec 2008 19:12:13 -0000 1.47
@@ -38,7 +38,9 @@
content::type::attribute::new -content_type imsld_imsld -attribute_name sequence_used_p -datatype string -pretty_name "#imsld.Sequence_Used#" -column_spec "char(1)"
content::type::attribute::new -content_type imsld_imsld -attribute_name learning_objective_id -datatype number -pretty_name "#imsld.lt_Learning_Objectives_I#" -column_spec "integer"
content::type::attribute::new -content_type imsld_imsld -attribute_name prerequisite_id -datatype number -pretty_name "#imsld.Prerequistes_ID#" -column_spec "integer"
+ content::type::attribute::new -content_type imsld_imsld -attribute_name resource_handler -datatype string -pretty_name "#imsld.Resource_Handler#" -column_spec "varchar(100)"
+
# learning objectives
content::type::new -content_type imsld_learning_objective -supertype content_revision -pretty_name "#imsld.lt_IMS-LD_Learning_Objec#" -pretty_plural "#imsld.lt_IMS-LD_Learning_Objec_1#" -table_name imsld_learning_objectives -id_column learning_objective_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.73 -r1.74
--- openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 26 Nov 2008 11:47:01 -0000 1.73
+++ openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 18 Dec 2008 19:12:14 -0000 1.74
@@ -654,6 +654,7 @@
-resource_node
-parent_id
-tmp_dir
+ {-resource_handler "file-storage"}
{-lpplist ""}
} {
Parses an IMS-LD resource and stores all the information in the database, such as files, dependencies, etc
@@ -734,6 +735,9 @@
set found_id_in_list 0
# TODO: set this variable properly:
set import_with_xowiki 0
+ if { $resource_handler eq "xowiki" } {
+ set import_with_xowiki 1
+ }
foreach filex $filex_list {
set filex_href [imsld::parse::get_attribute -node $filex -attr_name href]
@@ -771,7 +775,8 @@
# map resource with file
if { $import_with_xowiki } {
- relation_add -extra_vars $extra_vars imsld_resource_xowiki_rel $resource_id $filex_id
+ relation_add -extra_vars $extra_vars imsld_res_files_rel $resource_id $filex_id
+# relation_add -extra_vars $extra_vars imsld_resource_xowiki_rel $resource_id $filex_id
} else {
relation_add -extra_vars $extra_vars imsld_res_files_rel $resource_id $filex_id
}
@@ -810,7 +815,8 @@
-manifest_id $manifest_id \
-activity_name $activity_name \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
if { ![lindex $dependency_resource_list 0] } {
# return this value and let the user know there was an error (becuase if succeded, it does nothing here)
return $dependency_resource_list
@@ -828,6 +834,7 @@
-parent_id
-tmp_dir
{-parent_item_id ""}
+ {-resource_handler "file-storage"}
{-lpplist ""}
} {
Parse IMS-LD item node and stores all the information in the database, such as the resources, resources items, etc.
@@ -874,6 +881,7 @@
-activity_name $activity_name \
-parent_id $parent_id \
-tmp_dir $tmp_dir \
+ -resource_handler $resource_handler \
-lpplist $lpplist]
set resource_id [lindex $resource_list 0]
if { !$resource_id } {
@@ -894,7 +902,8 @@
-activity_name $activity_name \
-parent_id $parent_id \
-tmp_dir $tmp_dir \
- -parent_item_id $item_id]
+ -parent_item_id $item_id \
+ -resource_handler $resource_handler ]
set nested_item_id [lindex $nested_item_list 0]
if { !$nested_item_id } {
@@ -915,6 +924,7 @@
-parent_id
-tmp_dir
{-parent_role_id ""}
+ {-resource_handler "file-storage"}
} {
Parse IMS-LD role node and stores all the information in the database.
@@ -990,7 +1000,8 @@
-manifest_id $manifest_id \
-item_node $information_item \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set item_id [lindex $item_list 0]
if { !$item_id } {
@@ -1012,7 +1023,8 @@
-tmp_dir $tmp_dir \
-roles_node $nested_role \
-parent_role_id $role_id \
- -component_id $component_id]
+ -component_id $component_id \
+ -resource_handler $resource_handler ]
if { ![lindex $role_list 0] } {
# an error happened, abort and return the list whit the error
return $role_list
@@ -1512,6 +1524,7 @@
-manifest_id:required
-parent_id:required
-tmp_dir:required
+ {-resource_handler "file-storage"}
} {
Parse a learning objective and stores all the information in the database.
@@ -1541,7 +1554,8 @@
-manifest_id $manifest_id \
-item_node $imsld_item \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set item_id [lindex $item_list 0]
if { !$item_id } {
@@ -1561,6 +1575,7 @@
-manifest_id
-parent_id
-tmp_dir
+ {-resource_handler "file-storage"}
} {
Parse a prerequisite and stores all the information in the database.
@@ -1590,7 +1605,8 @@
-manifest_id $manifest_id \
-item_node $imsld_item \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set item_id [lindex $item_list 0]
if { !$item_id } {
@@ -1611,6 +1627,7 @@
{-activity_name ""}
-parent_id
-tmp_dir
+ {-resource_handler "file-storage"}
{-lpplist ""}
} {
Parse a activity description and stores all the information in the database.
@@ -1643,6 +1660,7 @@
-activity_name $activity_name \
-parent_id $parent_id \
-tmp_dir $tmp_dir \
+ -resource_handler $resource_handler \
-lpplist $lpplist]
set item_id [lindex $item_list 0]
@@ -1664,6 +1682,7 @@
-manifest_id
-parent_id
-tmp_dir
+ {-resource_handler "file-storage"}
} {
Parse a learning object and stores all the information in the database.
@@ -1703,8 +1722,9 @@
-manifest_id $manifest_id \
-item_node $learning_object_item \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
-
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
+
set item_id [lindex $item_list 0]
if { !$item_id } {
# an error happened, abort and return the list whit the error
@@ -1749,6 +1769,7 @@
-manifest_id
-parent_id
-tmp_dir
+ {-resource_handler "file-storage"}
} {
Parse a service and stores all the information in the database.
@@ -1939,7 +1960,8 @@
-manifest_id $manifest_id \
-item_node $conference_item \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set imsld_item_id [lindex $item_list 0]
if { !$imsld_item_id } {
@@ -2085,7 +2107,8 @@
-manifest_id $manifest_id \
-item_node $imsld_item \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set imsld_item_id [lindex $item_list 0]
if { !$imsld_item_id } {
@@ -2115,6 +2138,7 @@
-manifest_id
-parent_id
-tmp_dir
+ {-resource_handler "file-storage"}
} {
Parse a environment and stores all the information in the database.
@@ -2158,7 +2182,8 @@
-manifest_id $manifest_id \
-manifest $manifest \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set learning_object_id [lindex $learning_object_list 0]
if { !$learning_object_id } {
@@ -2175,7 +2200,8 @@
-manifest_id $manifest_id \
-manifest $manifest \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
if { ![lindex $service_list 0] } {
# there is an error, abort and return the list with the error
return $service_list
@@ -2220,7 +2246,8 @@
-manifest $manifest \
-parent_id $parent_id \
-component_id $component_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set environment_ref_id [lindex $environment_ref_list 0]
if { !$environment_ref_id } {
# there is an error, abort and return the list with the error
@@ -2323,6 +2350,7 @@
-manifest_id
-parent_id
-tmp_dir
+ {-resource_handler "file-storage"}
{-lpplist ""}
} {
Parse a learning activity and stores all the information in the database.
@@ -2353,7 +2381,8 @@
-manifest_id $manifest_id \
-parent_id $parent_id \
-manifest $manifest \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set learning_objective_id [lindex $learning_objective_list 0]
if { !$learning_objective_id } {
@@ -2372,7 +2401,8 @@
-manifest_id $manifest_id \
-manifest $manifest \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set prerequisite_id [lindex $prerequisite_list 0]
if { !$prerequisite_id } {
@@ -2393,6 +2423,7 @@
-activity_name $title \
-parent_id $parent_id \
-tmp_dir $tmp_dir \
+ -resource_handler $resource_handler \
-lpplist $lpplist]
set activity_description_id [lindex $activity_description_list 0]
@@ -2492,7 +2523,8 @@
-manifest_id $manifest_id \
-item_node $feedback_item \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set item_id [lindex $item_list 0]
if { !$item_id } {
# an error happened, abort and return the list whit the error
@@ -2577,6 +2609,7 @@
-manifest_id
-parent_id
-tmp_dir
+ {-resource_handler "file-storage"}
} {
Parse a support activity and stores all the information in the database.
@@ -2609,7 +2642,8 @@
-manifest $manifest \
-activity_name $title \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set activity_description_id [lindex $activity_description_list 0]
if { !$activity_description_id } {
@@ -2710,7 +2744,8 @@
-manifest_id $manifest_id \
-item_node $feedback_item \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set item_id [lindex $item_list 0]
if { !$item_id } {
# an error happened, abort and return the list whit the error
@@ -2813,6 +2848,7 @@
-manifest_id
-parent_id
-tmp_dir
+ {-resource_handler "file-storage"}
} {
Parse a activity structure and stores all the information in the database.
@@ -2871,7 +2907,8 @@
-manifest_id $manifest_id \
-item_node $information_item \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set information_id [lindex $item_list 0]
if { !$information_id } {
@@ -2971,7 +3008,8 @@
-manifest_id $manifest_id \
-manifest $manifest \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set activity_structure_ref_id [lindex $activity_structure_ref_list 0]
if { !$activity_structure_ref_id } {
@@ -3075,7 +3113,8 @@
-manifest_id $manifest_id \
-manifest $manifest \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set activity_structure_ref_id [lindex $activity_structure_ref_list 0]
if { !$activity_structure_ref_id } {
@@ -3163,7 +3202,8 @@
-manifest_id $manifest_id \
-manifest $manifest \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set activity_structure_ref_id [lindex $activity_structure_ref_list 0]
if { !$activity_structure_ref_id } {
@@ -3426,6 +3466,7 @@
-parent_id
-tmp_dir
-sort_order
+ {-resource_handler "file-storage"}
} {
Parse a act and stores all the information in the database.
@@ -3583,7 +3624,8 @@
-manifest_id $manifest_id \
-item_node $feedback_item \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set item_id [lindex $item_list 0]
if { !$item_id } {
# an error happened, abort and return the list whit the error
@@ -3687,6 +3729,7 @@
-parent_id
-tmp_dir
-sort_order
+ {-resource_handler "file-storage"}
} {
Parse a play and stores all the information in the database.
@@ -3791,7 +3834,9 @@
-manifest_id $manifest_id \
-item_node $feedback_item \
-parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
+
set item_id [lindex $item_list 0]
if { !$item_id } {
# an error happened, abort and return the list whit the error
@@ -3854,7 +3899,8 @@
-manifest_id $manifest_id \
-parent_id $parent_id \
-tmp_dir $tmp_dir \
- -sort_order $count]
+ -sort_order $count \
+ -resource_handler $resource_handler ]
set act_id [lindex $act_list 0]
if { !$act_id } {
# an error happened, abort and return the list whit the error
@@ -3931,11 +3977,12 @@
if { $found_p } {
# ok, let's create the learning activity
set learning_activity_ref_list [imsld::parse::parse_and_create_learning_activity -activity_node $referenced_learning_activity_node \
- -component_id $component_id \
- -manifest_id $manifest_id \
- -manifest $manifest \
- -parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -component_id $component_id \
+ -manifest_id $manifest_id \
+ -manifest $manifest \
+ -parent_id $parent_id \
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set activity_id [lindex $learning_activity_ref_list 0]
if { !$activity_id } {
@@ -3980,11 +4027,12 @@
if { $found_p } {
# ok, let's create the support activity
set support_activity_ref_list [imsld::parse::parse_and_create_support_activity -activity_node $referenced_support_activity_node \
- -component_id $component_id \
- -manifest_id $manifest_id \
- -manifest $manifest \
- -parent_id $parent_id \
- -tmp_dir $tmp_dir]
+ -component_id $component_id \
+ -manifest_id $manifest_id \
+ -manifest $manifest \
+ -parent_id $parent_id \
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set activity_id [lindex $learning_activity_ref_list 0]
if { !$activity_id } {
@@ -4157,6 +4205,7 @@
-manifest_id:required
{-community_id ""}
-tmp_dir:required
+ {-resource_handler "file-storage"}
} {
Parse a XML IMS LD file and store all the information found in the database, such as the manifest, the organization, the imsld with its components, method, activities, etc.
@@ -4231,7 +4280,8 @@
-manifest_id $manifest_id \
-parent_id $cr_folder_id \
-manifest $manifest \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set learning_objective_id [lindex $learning_objective_list 0]
if { !$learning_objective_id } {
@@ -4250,7 +4300,8 @@
-manifest_id $manifest_id \
-manifest $manifest \
-parent_id $cr_folder_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set prerequisite_id [lindex $prerequisite_list 0]
if { !$prerequisite_id } {
@@ -4268,6 +4319,7 @@
[list sequence_p $imsld_sequence_p] \
[list learning_objective_id $learning_objective_id] \
[list prerequisite_id $prerequisite_id] \
+ [list resource_handler $resource_handler] \
[list organization_id $organization_id]] \
-content_type imsld_imsld \
-title $imsld_title \
@@ -4295,7 +4347,8 @@
-parent_id $cr_folder_id \
-tmp_dir $tmp_dir \
-roles_node $learner \
- -component_id $component_id]
+ -component_id $component_id \
+ -resource_handler $resource_handler ]
if { ![lindex $learner_parse_list 0] } {
# an error happened, abort and return the list whit the error
return $learner_parse_list
@@ -4312,7 +4365,8 @@
-parent_id $cr_folder_id \
-tmp_dir $tmp_dir \
-roles_node $staff \
- -component_id $component_id]
+ -component_id $component_id \
+ -resource_handler $resource_handler ]
if { ![lindex $staff_parse_list 0] } {
# an error happened, abort and return the list whit the error
return $staff_parse_list
@@ -4350,7 +4404,8 @@
-manifest_id $manifest_id \
-manifest $manifest \
-parent_id $cr_folder_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set environment_ref_id [lindex $environment_ref_list 0]
if { !$environment_ref_id } {
# there is an error, abort and return the list with the error
@@ -4384,6 +4439,7 @@
-manifest_id $manifest_id \
-parent_id $cr_folder_id \
-tmp_dir $tmp_dir \
+ -resource_handler $resource_handler \
-lpplist $lpplist]
if { ![lindex $learning_activity_list 0] } {
# an error happened, abort and return the list whit the error
@@ -4409,7 +4465,8 @@
-manifest $manifest \
-manifest_id $manifest_id \
-parent_id $cr_folder_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
if { ![lindex $support_activity_list 0] } {
# an error happened, abort and return the list whit the error
return $support_activity_list
@@ -4429,7 +4486,8 @@
-manifest $manifest \
-manifest_id $manifest_id \
-parent_id $cr_folder_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
if { ![lindex $activity_structure_list 0] } {
# an error happened, abort and return the list whit the error
return $activity_structure_list
@@ -4518,7 +4576,8 @@
-manifest_id $manifest_id \
-item_node $feedback_item \
-parent_id $cr_folder_id \
- -tmp_dir $tmp_dir]
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler ]
set item_id [lindex $item_list 0]
if { !$item_id } {
# an error happened, abort and return the list whit the error
@@ -4575,7 +4634,9 @@
-manifest_id $manifest_id \
-parent_id $cr_folder_id \
-tmp_dir $tmp_dir \
- -sort_order $count]
+ -sort_order $count \
+ -resource_handler $resource_handler ]
+
if { ![lindex $play_list 0] } {
# an error happened, abort and return the list whit the error
return $play_list
@@ -4749,6 +4810,7 @@
-manifest_id $manifest_id \
-parent_id $cr_folder_id \
-tmp_dir $tmp_dir \
+ -resource_handler $resource_handler \
-lpplist $lpplist]
set resource_id [lindex $resource_list 0]
if { !$resource_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.108 -r1.109
--- openacs-4/packages/imsld/tcl/imsld-procs.tcl 9 Dec 2008 17:13:22 -0000 1.108
+++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 18 Dec 2008 19:12:17 -0000 1.109
@@ -2523,7 +2523,6 @@
set root_folder_id [fs::get_root_folder -package_id $fs_package_id]
db_1row get_resource_info { *SQL* }
- set files_node [$dom_doc createElement ul]
if { ![string eq $resource_type "webcontent"] && ![string eq $acs_object_id ""] } {
# if the resource type is not webcontent or has an associated object_id (special cases)...
@@ -2562,17 +2561,36 @@
} elseif { [string eq $resource_type "imsldcontent"] } {
- foreach file_list [db_list_of_lists associated_files { *SQL* }] {
+ db_1row get_imsld {
+ select i.imsld_id, i.resource_handler
+ from imsld_runs r, imsld_imslds i
+ where r.run_id = :run_id
+ and r.imsld_id = i.imsld_id
+ }
+
+ set associated_files_query "associated_files"
+ if { $resource_handler eq "xowiki" } {
+ set associated_files_query "associated_xo_files"
+ }
- set imsld_file_id [lindex $file_list 0]
- set file_name [lindex $file_list 1]
- set item_id [lindex $file_list 2]
- set parent_id [lindex $file_list 3]
- # get the fs file path
- set folder_path [db_exec_plsql get_folder_path { *SQL* }]
- db_0or1row get_fs_file_url { *SQL* }
- set fs_file_url $file_url
- set file_url "imsld-content-serve"
+ foreach file_list [db_list_of_lists $associated_files_query { *SQL* }] {
+ if { $resource_handler eq "xowiki" } {
+ set page_id [lindex $file_list 0]
+ set file_name [lindex $file_list 1]
+ set url "xowiki-view/$page_id"
+ set fs_file_url [export_vars -base [imsld::xowiki::page_url -item_id $page_id] {{template_file "/packages/imsld/lib/wiki-default"}}]
+ } else {
+ set imsld_file_id [lindex $file_list 0]
+ set file_name [lindex $file_list 1]
+ set item_id [lindex $file_list 2]
+ set parent_id [lindex $file_list 3]
+ # get the fs file path
+ set folder_path [db_exec_plsql get_folder_path { *SQL* }]
+ db_0or1row get_fs_file_url { *SQL* }
+ set fs_file_url $file_url
+ }
+
+ set file_url "imsld-content-serve"
set a_node [$dom_doc createElement a]
$a_node setAttribute href "[export_vars -base "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]imsld-finish-resource" {file_url $file_url resource_item_id $resource_item_id run_id $run_id}]"
$a_node setAttribute target "_blank"
@@ -2603,15 +2621,35 @@
} else {
# is webcontent, let's get the associated files
- foreach file_list [db_list_of_lists associated_files { *SQL* }] {
- set imsld_file_id [lindex $file_list 0]
- set file_name [lindex $file_list 1]
- set item_id [lindex $file_list 2]
- set parent_id [lindex $file_list 3]
- # get the fs file path
- set folder_path [db_exec_plsql get_folder_path { *SQL* }]
- set fs_file_url [db_1row get_fs_file_url { *SQL* }]
- set file_url "[apm_package_url_from_id $fs_package_id]view/${file_url}"
+
+ db_1row get_imsld {
+ select i.imsld_id, i.resource_handler
+ from imsld_runs r, imsld_imslds i
+ where r.run_id = :run_id
+ and r.imsld_id = i.imsld_id
+ }
+
+ set associated_files_query "associated_files"
+ if { $resource_handler eq "xowiki" } {
+ set associated_files_query "associated_xo_files"
+ }
+
+ foreach file_list [db_list_of_lists $associated_files_query { *SQL* }] {
+ if { $resource_handler eq "xowiki" } {
+ set url "xowiki-view/$page_id"
+ set url [export_vars -base [imsld::xowiki::page_url -item_id $page_id] {{template_file "/packages/imsld/lib/wiki-default"}}]
+ set file_url url
+ set file_name wikifile
+ } else {
+ set imsld_file_id [lindex $file_list 0]
+ set file_name [lindex $file_list 1]
+ set item_id [lindex $file_list 2]
+ set parent_id [lindex $file_list 3]
+ # get the fs file path
+ set folder_path [db_exec_plsql get_folder_path { *SQL* }]
+ set fs_file_url [db_1row get_fs_file_url { *SQL* }]
+ set file_url "[apm_package_url_from_id $fs_package_id]view/${file_url}"
+ }
set a_node [$dom_doc createElement a]
$a_node setAttribute href "[export_vars -base "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]imsld-finish-resource" {file_url $file_url resource_item_id $resource_item_id run_id $run_id}]"
$a_node setAttribute target "_blank"
@@ -2639,19 +2677,11 @@
}
}
# get associated urls
- set wiki_query {
- select ar.object_id_two as page_id
- from acs_rels ar,
- imsld_res_files_rels map
- where ar.object_id_one = :resource_item_id
- and ar.rel_id = map.rel_id
- }
+
db_foreach associated_urls { *SQL* } {
- set a_node [$dom_doc createElement a]
-# set url "xowiki-view/$page_id"
-# set url [export_vars -base [imsld::xowiki::page_url -item_id $page_id] {{template_file "/packages/imsld/lib/wiki-default"}}]
- $a_node setAttribute href "[export_vars -base "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]imsld-finish-resource" { {file_url "[export_vars -base $url]"} resource_item_id run_id}]"
- ns_log notice "resource item: $resource_item_id"
+ set a_node [$dom_doc createElement a]
+
+ $a_node setAttribute href "[export_vars -base "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]imsld-finish-resource" { {file_url "[export_vars -base $url]"} resource_item_id run_id}]"
$a_node setAttribute onclick "return loadContent(this.href)"
$a_node setAttribute target "_blank"
$a_node setAttribute title "$url"
@@ -3606,7 +3636,7 @@
}
}
$dom_node appendChild $activity_node
- imsld::generate_resources_tree -run_id $run_id -user_id $user_id -dom_node $activity_node -dom_doc $dom_doc
+ imsld::generate_resources_tree -activity_item_id $activity_item_id -run_id $run_id -user_id $user_id -dom_node $activity_node -dom_doc $dom_doc
}
}
structure {
@@ -3920,7 +3950,7 @@
}
}
$dom_node appendChild $activity_node
- imsld::generate_resources_tree -run_id $run_id -user_id $user_id -dom_node $activity_node -dom_doc $dom_doc
+ imsld::generate_resources_tree -activity_item_id $activity_item_id -run_id $run_id -user_id $user_id -dom_node $activity_node -dom_doc $dom_doc
}
}
}
Index: openacs-4/packages/imsld/tcl/imsld-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs.xql,v
diff -u -r1.42 -r1.43
--- openacs-4/packages/imsld/tcl/imsld-procs.xql 22 Oct 2008 10:55:35 -0000 1.42
+++ openacs-4/packages/imsld/tcl/imsld-procs.xql 18 Dec 2008 19:12:17 -0000 1.43
@@ -1730,6 +1730,23 @@
+
+
+
+ select ci.item_id as page_id, ci.name as file_name
+ from acs_rels ar, imsld_res_files_rels map,
+ cr_revisions cr, cr_items ci
+ where ar.object_id_one = :resource_item_id
+ and ar.object_id_two = cr.item_id
+ and cr.item_id = ci.item_id
+ and ar.rel_id = map.rel_id
+ and content_revision__is_live(cr.revision_id) = 't'
+ and map.displayable_p = 't'
+
+
+
+
+
select content_item__get_path(:parent_id,:root_folder_id);
Index: openacs-4/packages/imsld/tcl/imsld-xowiki-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-xowiki-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/imsld/tcl/imsld-xowiki-procs.tcl 22 Oct 2008 10:47:53 -0000 1.1
+++ openacs-4/packages/imsld/tcl/imsld-xowiki-procs.tcl 18 Dec 2008 19:12:17 -0000 1.2
@@ -38,7 +38,7 @@
@error
} {
- set mime_type [ns_guesstype $complete_path]
+ set mime_type [cr_filename_to_mime_type $complete_path]
set community_id [dotlrn_community::get_community_id]
set xw_url "[dotlrn_community::get_community_url $community_id]xowiki/"
@@ -47,7 +47,7 @@
set package_id $node(package_id)
::xowiki::Package initialize -package_id $package_id -url $xw_url -user_id [ad_conn user_id]
-
+
if { [string match "text/*" $mime_type] } {
set file [open $complete_path]
set content [read $file]
@@ -74,10 +74,6 @@
$page save
}
} else {
- set file [open $complete_path]
- set content [read $file]
- close $file
-
set page [$package_id resolve_page "file:$file_name" method]
if {$page eq ""} {