+
Index: openacs-4/packages/imsld/lib/monitor/activity-tree.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/monitor/activity-tree.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/imsld/lib/monitor/activity-tree.adp 18 Feb 2009 19:01:13 -0000 1.1
+++ openacs-4/packages/imsld/lib/monitor/activity-tree.adp 17 Jun 2009 08:00:01 -0000 1.2
@@ -4,10 +4,22 @@
@imsld_title@
Index: openacs-4/packages/imsld/sql/postgresql/imsld-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-create.sql,v
diff -u -r1.16 -r1.17
--- openacs-4/packages/imsld/sql/postgresql/imsld-create.sql 24 Oct 2006 10:09:50 -0000 1.16
+++ openacs-4/packages/imsld/sql/postgresql/imsld-create.sql 17 Jun 2009 08:00:01 -0000 1.17
@@ -12,3 +12,5 @@
\i imsld-production-delivery-package-create.sql
\i imsld-tree-create.sql
\i imsld-level-c-create.sql
+
+\i imsld-gsi-a-create.sql
Index: openacs-4/packages/imsld/sql/postgresql/imsld-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-drop.sql,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/imsld/sql/postgresql/imsld-drop.sql 24 Oct 2006 10:09:50 -0000 1.10
+++ openacs-4/packages/imsld/sql/postgresql/imsld-drop.sql 17 Jun 2009 08:00:01 -0000 1.11
@@ -11,10 +11,10 @@
\i imsld-cp-drop.sql
-\i imsld-production-delivery-drop.sql
-
\i imsld-production-delivery-package-drop.sql
+\i imsld-production-delivery-drop.sql
+
\i imsld-level-b-drop.sql
\i imsld-level-c-drop.sql
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.5 -r1.6
--- openacs-4/packages/imsld/sql/postgresql/imsld-level-a-drop.sql 5 Jun 2008 17:40:03 -0000 1.5
+++ openacs-4/packages/imsld/sql/postgresql/imsld-level-a-drop.sql 17 Jun 2009 08:00:01 -0000 1.6
@@ -7,6 +7,10 @@
drop table imsld_scheduled_time_limits;
+drop table imsld_res_files_rels;
+
+drop table imsld_res_xowiki_rels;
+
drop table imsld_learning_objects cascade;
drop table imsld_imslds cascade;
Index: openacs-4/packages/imsld/sql/postgresql/imsld-level-c-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-level-c-drop.sql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/imsld/sql/postgresql/imsld-level-c-drop.sql 21 Dec 2006 15:20:47 -0000 1.2
+++ openacs-4/packages/imsld/sql/postgresql/imsld-level-c-drop.sql 17 Jun 2009 08:00:01 -0000 1.3
@@ -11,4 +11,6 @@
drop table imsld_runtime_activities_rels cascade;
-drop sequence imsld_rar_seq;
+drop view imsld_rar_seq;
+
+drop sequence t_imsld_rar_seq;
Index: openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-package-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-package-drop.sql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-package-drop.sql 16 May 2006 09:24:35 -0000 1.1
+++ openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-package-drop.sql 17 Jun 2009 08:00:01 -0000 1.2
@@ -5,6 +5,12 @@
delete from acs_objects where object_type = 'imsld_run';
+select acs_attribute__drop_attribute('imsld_run', 'imsld_id');
+
+select acs_attribute__drop_attribute('imsld_run', 'status');
+
+delete from acs_object_type_tables where object_type = 'imsld_run';
+
select acs_object_type__drop_type('imsld_run','f');
delete from acs_rels where rel_type = 'imsld_run_users_group_rel';
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.11 -r1.12
--- openacs-4/packages/imsld/tcl/apm-callback-procs.tcl 18 Dec 2008 19:12:12 -0000 1.11
+++ openacs-4/packages/imsld/tcl/apm-callback-procs.tcl 17 Jun 2009 08:00:01 -0000 1.12
@@ -26,6 +26,9 @@
# create default relationships with non IMS-LD objects
imsld::install::init_ext_rels
+ #create the GSI model
+ imsld::gsi::install::do_install
+
return 1
}
@@ -51,7 +54,9 @@
} {
Proc calls and tasks needed to be donde before the uninstallation of the imsld package.
} {
-
+ #clean the GSI model
+ imsld::gsi::uninstall::do_uninstall
+
# clean rels
imsld::uninstall::delete_rels
imsld::uninstall::delete_ext_rels
@@ -95,6 +100,9 @@
-attribute_name resource_handler -datatype string \
-pretty_name "#imsld.Resource_Handler#" -column_spec "varchar(100)"
}
+ 1.7d 1.8d {
+ imsld::gsi::install::do_install
+ }
}
}
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.25 -r1.26
--- openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl 17 Apr 2008 17:18:16 -0000 1.25
+++ openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl 17 Jun 2009 08:00:01 -0000 1.26
@@ -180,12 +180,20 @@
ad_proc -public imsld::condition::eval_change_property_value {
-change_property_value_xml:required
-run_id:required
+ -user_id
} {
Executes the expression of the change-property-value and sets the result to the associated property.
} {
dom parse $change_property_value_xml document
$document documentElement change_property_value_root
- imsld::statement::execute -run_id $run_id -statement [$change_property_value_root childNodes]
+ ns_log Notice "[info vars]"
+ if {![info exists user_id]} {
+ ns_log Notice "eval_change_property_value without user_id"
+ imsld::statement::execute -run_id $run_id -statement [$change_property_value_root childNodes]
+ } {
+ ns_log Notice "eval_change_property_value with user_id: $user_id"
+ imsld::statement::execute -run_id $run_id -statement [$change_property_value_root childNodes] -user_id $user_id
+ }
}
ad_proc -public imsld::condition::eval_when_prop_value_is_set {
@@ -637,6 +645,7 @@
if {![info exist user_id]} {
set user_id [ad_conn user_id]
}
+ ns_log Notice "statement::execute with user_id: $user_id"
foreach executeNode $statement {
switch -- [$executeNode localName] {
@@ -751,7 +760,13 @@
{property-ref} {
set propertyValue [imsld::runtime::property::property_value_get -run_id $run_id -user_id $user_id -identifier [$propertyvalueChildNode getAttribute {ref}]]
}
-
+ {external-value} {
+ #gsi-hook for external-value type.
+ #The value will be extracted from the proper service
+ set propertyValue [imsld::gsi::get_external_value -run_id $run_id \
+ -user_id $user_id \
+ -node $propertyvalueChildNode]
+ }
}
}
{TEXT_NODE} {
Index: openacs-4/packages/imsld/tcl/imsld-export-files-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-export-files-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/imsld/tcl/imsld-export-files-procs.tcl 18 Feb 2009 11:10:46 -0000 1.1
+++ openacs-4/packages/imsld/tcl/imsld-export-files-procs.tcl 17 Jun 2009 08:00:01 -0000 1.2
@@ -1,3 +1,5 @@
+package require http
+
namespace eval imsld::export::files {}
###############################################################################
@@ -20,8 +22,6 @@
file mkdir $path/$inside_path/
}
-
-
if {[fs_file_p [expr $imsld_file_id-1]] == 1} {
set data [fs__datasource $imsld_file_id]
set url [lindex $data [expr [lsearch $data content]+1]]
@@ -31,3 +31,484 @@
}
}
}
+
+
+###############################################################################
+# Call this function to change references in html labels
+###############################################################################
+ad_proc -public imsld::export::files::modify_links {
+ -manifest_id:required
+ -xo_page_id:required
+ -path:required
+} {
+ This proc is called to change references in html labels for exporting the UoL
+} {
+ #Get page name
+ db_1row get_page_name {select title from acs_objects where object_id=:xo_page_id}
+ set page_title [string map {"%2f" "/"} $title]
+ set page_name [string range $page_title [expr [string last "/" $page_title]+1] end]
+##############################################
+ #Change : for _ in case language is specified in name
+ regsub -all {:} $page_name {_} page_name
+ if {[string first "." $page_name] == -1} {
+ set page_name ${page_name}.html
+ }
+##############################################
+
+ #Get Xowiki page
+ set file_data "[imsld::xowiki::page_content -item_id $xo_page_id]"
+
+ #Get root path to files stored in xowiki
+ #Get xowiki package url
+ db_1row get_xowiki_package_id {select package_id, title from acs_objects where object_id=:xo_page_id}
+ set xowiki_package_url [apm_package_url_from_id $package_id]
+
+ #Parse Xowiki page
+ set data_tree [dom parse -html $file_data]
+ set root [$data_tree documentElement]
+
+
+ #Call proc that changes href attribute in a labels
+ imsld::export::files::modify_a -root $root -xowiki_package_url $xowiki_package_url
+ imsld::export::files::modify_frame -root $root -xowiki_package_url $xowiki_package_url
+ imsld::export::files::modify_css -root $root -xowiki_package_url $xowiki_package_url
+ set resource_files_list [imsld::export::files::modify_img -root $root -xowiki_package_url $xowiki_package_url -xowiki_package_id $package_id -path $path]
+
+ #Once we have changed the references of the file, then we copy the file
+ #Write page file
+ set new_file [open "${path}/$page_name" w]
+ #Delete unnecessary code from page
+ set data [$root asHTML]
+ set pos [string last "content-chunk-footer" $data]
+ if {$pos > 0} {set data [string range $data 0 [expr $pos-13]]}
+ if {[string first "${data}"}
+ puts $new_file $data
+ close $new_file
+
+ return $resource_files_list
+
+}
+
+
+###############################################################################
+# Call this function to change href attribute in anchor labels
+###############################################################################
+ad_proc -public imsld::export::files::modify_a {
+ -root:required
+ -xowiki_package_url:required
+} {
+ This proc is called to change href attribute in anchor labels
+} {
+ #Get all anchor elements
+ set a_nodes [$root selectNodes //a]
+
+ #Loop to work with all anchor nodes
+ set num_elements [llength $a_nodes]
+ for {set i 0} {$i<$num_elements} {incr i} {
+ set a_href [[lindex $a_nodes $i] getAttribute href NONE]
+ if {[string first "http://" $a_href] == 0 || [string first "https://" $a_href] == 0 || [string first "#" $a_href] == 0 || $a_href == "NONE"} {
+ continue
+ } else {
+ #If the code reaches this point, it means that there is a local reference to another file
+ #Check if a_href is a reference to a xowiki file
+ if {[string first $xowiki_package_url $a_href] == 0} {
+ #Build reference to export
+ set a_href [string range $a_href [string length $xowiki_package_url] end]
+ set a_href [string map {"%2f" "/"} $a_href]
+ set a_href [string range $a_href [expr [string first "/" $a_href]+1] end]
+
+ #Change href attribute value to write in it the new reference
+ [lindex $a_nodes $i] setAttribute href $a_href
+ }
+ ##########################################################################################
+ # May take into account other possibilities in an else block
+ ##########################################################################################
+ }
+ }
+}
+
+
+###############################################################################
+# Call this function to change src attribute in frame labels
+###############################################################################
+ad_proc -public imsld::export::files::modify_frame {
+ -root:required
+ -xowiki_package_url:required
+} {
+ This proc is called to change src attribute in frame labels
+} {
+ #Get all frame elements
+ set frame_nodes [$root selectNodes //frame]
+
+ #Loop to work with all frame nodes
+ set num_elements [llength $frame_nodes]
+ for {set i 0} {$i<$num_elements} {incr i} {
+ set frame_src [[lindex $frame_nodes $i] getAttribute src NONE]
+ #If frame is inside same xowiki community then change src attribute
+ if {[string first $xowiki_package_url $frame_src] == 0} {
+ #Build reference to export
+ set frame_src [string range $frame_src [string length $xowiki_package_url] end]
+ set frame_src [string map {"%2f" "/"} $frame_src]
+ set frame_src [string range $frame_src [expr [string first "/" $frame_src]+1] end]
+ #Change src attribute value to write in it the new reference
+ [lindex $frame_nodes $i] setAttribute src $frame_src
+ }
+ ##########################################################################################
+ # May take into account other possibilities in an else block
+ ##########################################################################################
+ }
+}
+
+
+###############################################################################
+# Call this function to change href attribute in link labels (for css)
+###############################################################################
+ad_proc -public imsld::export::files::modify_css {
+ -root:required
+ -xowiki_package_url:required
+} {
+ This proc is called to change href attribute in link labels that link to css files
+} {
+ #Get all frame elements
+ set link_nodes [$root selectNodes //link]
+
+ #Loop to work with all link nodes
+ set num_elements [llength $link_nodes]
+ for {set i 0} {$i<$num_elements} {incr i} {
+ set link_type [[lindex $link_nodes $i] getAttribute type NONE]
+ set link_href [[lindex $link_nodes $i] getAttribute href NONE]
+ #Check that the link is of text/css type
+ if {$link_type == "text/css"} {
+ #If link is inside same xowiki community then change href attribute
+ if {[string first $xowiki_package_url $link_href] == 0} {
+ #Build reference to export
+ set link_href [string range $link_href [string length $xowiki_package_url] end]
+ set link_href [string map {"%2f" "/"} $link_href]
+ set link_href [string range $link_href [expr [string first "/" $link_href]+1] end]
+#########################################################################################
+#########################################################################################
+############ The following code has not been tested ##################
+#########################################################################################
+#########################################################################################
+ if {[string first "download/file/" $link_href] == 0} {
+ set link_href [string range $link_href 14 end]
+ }
+ set file_title "file:$link_href"
+ #Get id of the file where the css file is stored
+ set content_item_id [string range [$xowiki_package_id resolve_page "$file_title" method] 2 end]
+
+ db_1row get_file_id {select object_id from acs_objects where title=:file_title and object_type='::xowiki::File' and context_id=:content_item_id}
+
+ #Get file and copy it to export folder
+ set data [fs__datasource $object_id]
+ #Get url of folder to copy file
+ set url [lindex $data [expr [lsearch $data content]+1]]
+ #Copy file
+ set link_href [string range $link_href [expr [string first "/" $link_href]+1] end]
+ if {[db_0or1row is_imsls_cp_file {select imsld_file_id from imsld_cp_files where path_to_file=:file_name}] == 1} {
+ file copy -force $url "$path/$link_href"
+ } else {
+ set position [string last "/" $link_href]
+ if {$position != -1} {
+ #Delete file path from file name
+ set link_href [string range [expr $position+1] end]
+ }
+
+ #Create folder to store resources if it doesn't exist
+ set aux_folder_name "export_res"
+ if {[file isdirectory "$path/$aux_folder_name"] == 0} {
+ exec mkdir "$path/$aux_folder_name"
+ }
+
+ #Build new file path
+ set link_href "${aux_folder_name}/$link_href"
+ file copy -force $url "$path/$link_href"
+ }
+#########################################################################################
+#########################################################################################
+ #Change src attribute value to write in it the new reference
+ [lindex $link_nodes $i] setAttribute href $link_href
+ }
+ }
+ ##########################################################################################
+ # May take into account other possibilities in an else block
+ ##########################################################################################
+ }
+}
+
+
+###############################################################################
+# Call this function to change src attribute in img labels
+###############################################################################
+ad_proc -public imsld::export::files::modify_img {
+ -root:required
+ -xowiki_package_url:required
+ -xowiki_package_id:required
+ -path:required
+} {
+ This proc is called to change src attribute in img labels
+} {
+ #Get package_id
+ set package_id [ad_conn package_id]
+ #Store community path
+ set community_path [apm_package_url_from_id $package_id]
+ set community_path [string range $community_path 0 [expr [string last "/imsld" $community_path]-1]]
+ set community_name [string range $community_path [expr [string last "/" $community_path]+1] end]
+
+ set resource_files_list [list]
+
+ #Get all image elements
+ set image_nodes [$root selectNodes //img]
+
+ #Loop to work with all image nodes
+ set num_elements [llength $image_nodes]
+ for {set i 0} {$i<$num_elements} {incr i} {
+ set src [[lindex $image_nodes $i] getAttribute src NONE]
+ if {$src != "NONE"} {
+ #Check if image src is a xowiki file
+ if {[string first $xowiki_package_url $src] == 0} {
+ #Compute file name
+ set position [string length $xowiki_package_url]
+ set file_name [string range $src $position end]
+ if {[string first "download/file/" $file_name] == 0} {
+ set file_name [string range $file_name 14 end]
+ }
+ set file_name [string map {"%2f" "/"} $file_name]
+ set file_title "file:$file_name"
+ #Get id of the file where the image is stored
+ set content_item_id [string range [$xowiki_package_id resolve_page "$file_title" method] 2 end]
+
+ db_1row get_file_id {select object_id from acs_objects where title=:file_title and object_type='::xowiki::File' and context_id=:content_item_id}
+
+ #Get file and copy it to export folder
+ set data [fs__datasource $object_id]
+ #Get url of folder to copy file
+ set url [lindex $data [expr [lsearch $data content]+1]]
+ #Copy file
+ set file_name [string range $file_name [expr [string first "/" $file_name]+1] end]
+ if {[db_0or1row is_imsls_cp_file {select imsld_file_id from imsld_cp_files where path_to_file=:file_name}] == 1} {
+ file copy -force $url "$path/$file_name"
+ } else {
+ set position [string last "/" $file_name]
+ if {$position != -1} {
+ #Delete file path from file name
+ set file_name [string range [expr $position+1] end]
+ }
+
+ #Create folder to store resources if it doesn't exist
+ set aux_folder_name "export_res"
+ if {[file isdirectory "$path/$aux_folder_name"] == 0} {
+ exec mkdir "$path/$aux_folder_name"
+ }
+
+ #Build new file path
+ set file_name "${aux_folder_name}/$file_name"
+ file copy -force $url "$path/$file_name"
+ }
+ #Add file to resource file list
+ lappend resource_files_list $file_name
+
+ #Change src attribute value to write it in file to be exported
+ [lindex $image_nodes $i] setAttribute src $file_name
+ } else {
+ #There is another case we have to compute. it is when the referenced file is stored in the same host
+ # but it is not in the xowiki community of imsld (it may be stored in a different xowiki community or
+ # in the file storage)
+
+ #First check that the url is local
+ if {[string first "http://" $src] != 0} {
+ #Create folder to store resources if it doesn't exist
+ set aux_folder_name "export_res"
+ if {[file isdirectory "$path/$aux_folder_name"] == 0} {
+ exec mkdir "$path/$aux_folder_name"
+ }
+
+ if {[string first "${community_path}/" $src] == 0} {
+ set src [string range $src [expr [string length $community_path]+1] end]
+ set type [string range $src 0 [expr [string first "/" $src]-1]]
+ #If type == file-storage
+ if {$type == "file-storage"} {
+ set src [string range $src 13 end]
+ #Here we can find to possibilities: view or download
+ if {[string first "view" $src] == 0} {
+ set src [string range $src 5 end]
+ #Get file name
+ set position [string last "/" $src]
+ set file_name [string range $src [expr $position+1] end]
+ set file_name "$aux_folder_name/$file_name"
+ if {$position != -1} {
+ set file_path [string range $src 0 [expr $position-1]]
+ } else {
+ set file_path ""
+ }
+
+ #Get file storage folder
+ db_1row get_folder_id {select acs1.object_id from acs_objects acs1, acs_objects acs2, acs_objects acs3 where acs1.context_id = acs2.object_id and acs2.title='#file-storage.file-storage#' and acs2.context_id = acs3.object_id and acs3.object_type = 'apm_package' and acs3.context_id = dotlrn_communities.community_id and dotlrn_communities.community_key = :community_name}
+ set folder_id $object_id
+ if {$file_path != ""} {
+ set position [string first "/" $file_path]
+ if {$position == 0} {
+ set file_path [string range $file_path 1 end]
+ set position [string first "/" $file_path]
+ }
+ while {$position > 0} {
+ #Get folder key name
+ set folder_name [string range $file_path 0 [expr $position-1]]
+
+ #Get folder_id
+ db_1row get_folder_id {select folder_id from fs_folders where key=:folder_name and parent_id=:folder_id}
+
+ set file_path [string range $file_path [expr $position+1] end]
+ #Update loop variable
+ set position [string first "/" $file_path]
+ }
+ }
+ #Check that the file exist
+ if {[db_0or1row get_file_id {select file_id, live_revision from fs_files where key=:file_name and parent_id=:folder_id}] == 1} {
+ #Copy file
+ if {[fs_file_p [expr $file_id]] == 1} {
+ set data [fs__datasource $live_revision]
+ set url [lindex $data [expr [lsearch $data content]+1]]
+ file copy -force $url "$path/$file_name"
+ }
+ #Add file to resource file list
+ lappend resource_files_list $file_name
+ }
+ #Change src attribute value to write it in file to be exported
+ [lindex $image_nodes $i] setAttribute src "$file_name"
+
+ } else {
+ #If the url is download
+ #Get file id
+ set position [string last "file%5fid=" $src]
+ if {$position > 0} {
+ set src [string range $src [expr $position+10] end]
+ } else {
+ set position [string last "file_id=" $src]
+ if {$position > 0} {
+ set src [string range $src [expr $position+8] end]
+ }
+ #If none of the previous conditions is fullfill, then a new kind of local url
+ # not taken into account appears or there is an error in the computed url.
+ }
+ #Copy file
+ if {[fs_file_p $src] == 1} {
+ #Get live revision and file name
+ db_1row get_live_revision {select live_revision, key from fs_files where file_id=:src}
+ set data [fs__datasource $live_revision]
+ set url [lindex $data [expr [lsearch $data content]+1]]
+ set file_name "$aux_folder_name/$key"
+ file copy -force $url "$path/$file_name"
+ }
+
+ #Add file to resource file list
+ lappend resource_files_list $file_name
+
+ #Change src attribute value to write it in file to be exported
+ [lindex $image_nodes $i] setAttribute src "$file_name"
+ }
+ }
+ } else {
+ #This is the case when the resource is stored in a different community
+ set src [string range $src 14 end]
+ #Get community name
+ set other_comm_name [string range $src 0 [expr [string first "/" $src]-1]]
+ set src [string range $src [expr [string first "/" $src]+1] end]
+ #Get storage type (file-storage or xowiki)
+ set type [string range $src 0 [expr [string first "/" $src]-1]]
+ set src [string range $src [expr [string first "/" $src]+1] end]
+ if {$type == "file-storage"} {
+ #Here we can find to possibilities: view or download
+ if {[string first "view" $src] == 0} {
+ set src [string range $src 5 end]
+ #Get file name
+ set position [string last "/" $src]
+ set file_nam [string range $src [expr $position+1] end]
+ set file_name "$aux_folder_name/$file_name"
+ if {$position != -1} {
+ set file_path [string range $src 0 [expr $position-1]]
+ } else {
+ set file_path ""
+ }
+
+ #Get file storage folder
+ db_1row get_folder_id {select acs1.object_id from acs_objects acs1, acs_objects acs2, acs_objects acs3 where acs1.context_id = acs2.object_id and acs2.title='#file-storage.file-storage#' and acs2.context_id = acs3.object_id and acs3.object_type = 'apm_package' and acs3.context_id = dotlrn_communities.community_id and dotlrn_communities.community_key = :other_comm_name}
+ set folder_id $object_id
+ if {$file_path != ""} {
+ set position [string first "/" $file_path]
+ if {$position == 0} {
+ set file_path [string range $file_path 1 end]
+ set position [string first "/" $file_path]
+ }
+ while {$position > 0} {
+ #Get folder key name
+ set folder_name [string range $file_path 0 [expr $position-1]]
+
+ #Get folder_id
+ db_1row get_folder_id {select folder_id from fs_folders where key=:folder_name and parent_id=:folder_id}
+
+ set file_path [string range $file_path [expr $position+1] end]
+ #Update loop variable
+ set position [string first "/" $file_path]
+ }
+ }
+ #Check that the file exist
+ if {[db_0or1row get_file_id {select file_id, live_revision from fs_files where key=:file_nam and parent_id=:folder_id}] == 1} {
+ #Copy file
+ if {[fs_file_p [expr $file_id]] == 1} {
+ set data [fs__datasource $live_revision]
+ set url [lindex $data [expr [lsearch $data content]+1]]
+ set file_name "$aux_folder_name/$file_nam"
+ file copy -force $url "$path/$file_name"
+ }
+ #Add file to resource file list
+ lappend resource_files_list $file_name
+ }
+ #Change src attribute value to write it in file to be exported
+ [lindex $image_nodes $i] setAttribute src "$file_name"
+
+ } else {
+ #If the url is download
+ #Get file id
+ set position [string last "file%5fid=" $src]
+ if {$position > 0} {
+ set src [string range $src [expr $position+10] end]
+ } else {
+ set position [string last "file_id=" $src]
+ if {$position > 0} {
+ set src [string range $src [expr $position+8] end]
+ }
+ }
+ #Copy file
+ if {[fs_file_p $src] == 1} {
+ #Get live revision and file name
+ db_1row get_live_revision {select live_revision, key from fs_files where file_id=:src}
+ set data [fs__datasource $live_revision]
+ set url [lindex $data [expr [lsearch $data content]+1]]
+ set file_name "$aux_folder_name/$key"
+ file copy -force $url "$path/$file_name"
+ }
+
+ #Add file to resource file list
+ lappend resource_files_list $file_name
+
+ #Change src attribute value to write it in file to be exported
+ [lindex $image_nodes $i] setAttribute src "$file_name"
+ }
+ }
+ #####################################################################
+ # Here may be an else block for Xowiki in other communities
+ #####################################################################
+ }
+ }
+ #########################################################################
+ # Here may be an else block for external urls
+ # This case has not been considered for implementation.
+ #########################################################################
+ }
+ }
+ }
+ return $resource_files_list
+}
+
+
Index: openacs-4/packages/imsld/tcl/imsld-export-ld-components-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-export-ld-components-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/imsld/tcl/imsld-export-ld-components-procs.tcl 18 Feb 2009 11:10:46 -0000 1.1
+++ openacs-4/packages/imsld/tcl/imsld-export-ld-components-procs.tcl 17 Jun 2009 08:00:01 -0000 1.2
@@ -105,6 +105,10 @@
if {$identifier != ""} {
$imsld_item setAttribute identifier $identifier
}
+ #Check if the reference is of a xowiki page, if it is the case, fill identifierref with resource_(resource_number)
+ if {[string first "item_" $identifier] == 0} {
+ set identifierref "resource_[string range $identifier [expr [string first "_" $identifier]+1] end]"
+ }
$imsld_item setAttribute identifierref $identifierref
if {$is_visible_p == "t"} {
set is_visible "true"
@@ -501,6 +505,11 @@
if {$identifier != ""} {
$imsld_item setAttribute identifier $identifier
}
+ #Check if the reference is of a xowiki page, if it is the case, fill identifierref with resource_(resource_number)
+ if {[string first "item_" $identifier] == 0} {
+ set identifierref "resource_[string range $identifier [expr [string first "_" $identifier]+1] end]"
+ }
+
$imsld_item setAttribute identifierref $identifierref
if {$is_visible_p == "t"} {
set is_visible "true"
@@ -541,7 +550,6 @@
if {$change_property_value_xml == ""} {
-
if {$feedback_title != ""} {
#Create feedback-description label
set feedback_description [$doc createElement "imsld:feedback-description"]
@@ -563,6 +571,10 @@
if {$identifier != ""} {
$imsld_item setAttribute identifier $identifier
}
+ #Check if the reference is of a xowiki page, if it is the case, fill identifierref with resource_(resource_number)
+ if {[string first "item_" $identifier] == 0} {
+ set identifierref "resource_[string range $identifier [expr [string first "_" $identifier]+1] end]"
+ }
$imsld_item setAttribute identifierref $identifierref
if {$is_visible_p == "t"} {
set is_visible "true"
@@ -788,14 +800,18 @@
}
#Get items associated to the learning_object
- db_multirow get_learning_object_item get_learning_object_item {select imsld_item_id, identifier, identifierref, is_visible_p, title from acs_rels, cr_items cr1, cr_items cr2, imsld_items, cr_revisions where :learning_object_id = cr1.latest_revision and cr1.item_id = object_id_one and object_id_two = cr2.item_id and cr2.latest_revision = imsld_item_id and revision_id = imsld_item_id} {
+ db_foreach get_learning_object_item {select imsld_item_id, identifier, identifierref, is_visible_p, title from acs_rels, cr_items cr1, cr_items cr2, imsld_items, cr_revisions where :learning_object_id = cr1.latest_revision and cr1.item_id = object_id_one and object_id_two = cr2.item_id and cr2.latest_revision = imsld_item_id and revision_id = imsld_item_id} {
#Write imsld:item label and content
set imsld_item [$doc createElement "imsld:item"]
$learning_object appendChild $imsld_item
#Add attributes of imsld:item label
if {$identifier != ""} {
$imsld_item setAttribute identifier $identifier
}
+ #Check if the reference is of a xowiki page, if it is the case, fill identifierref with resource_(resource_number)
+ if {[string first "item_" $identifier] == 0} {
+ set identifierref "resource_[string range $identifier [expr [string first "_" $identifier]+1] end]"
+ }
$imsld_item setAttribute identifierref $identifierref
if {$is_visible_p == "t"} {
set is_visible "true"
@@ -812,8 +828,12 @@
}
}
}
+
+
+
#If the current environment has one or more services, then write them
db_multirow get_services get_services {select service_id, identifier, is_visible_p, service_type from imsld_services where environment_id = cr_items.item_id and cr_items.latest_revision = :environment_id} {
+
#Write imsld:service label and content
set imsld_service [$doc createElement "imsld:service"]
$environment appendChild $imsld_service
@@ -908,6 +928,10 @@
if {$identifier != ""} {
$imsld_item setAttribute identifier $identifier
}
+ #Check if the reference is of a xowiki page, if it is the case, fill identifierref with resource_(resource_number)
+ if {[string first "item_" $identifier] == 0} {
+ set identifierref "resource_[string range $identifier [expr [string first "_" $identifier]+1] end]"
+ }
$imsld_item setAttribute identifierref $identifierref
if {$is_visible_p == "t"} {
set is_visible "true"
@@ -927,7 +951,7 @@
}
} elseif {$service_type == "send-mail"} {
#If service is of type send-mail, write send-mail content
- db_1row get_send_mail_data {select mail_id, recipients, is_visible_p, parameters from imsld_send_mail_services where service_id = cr_items.item_id and cr_items.latest_revision = :service_id}
+ db_1row get_send_mail_data {select mail_id, recipients, is_visible_p, parameters from imsld_send_mail_services, cr_items where service_id = cr_items.item_id and cr_items.latest_revision = :service_id}
#Write imsld:send-mail label and content
set imsld_send_mail [$doc createElement "imsld:send-mail"]
$imsld_service appendChild $imsld_send_mail
@@ -951,8 +975,9 @@
$imsld_title appendChild [$doc createTextNode "$title"]
}
+
#Add mail data if it exists
- db_multirow get_mail_data get_mail_data {select identifier, mail_data, email_property_id, username_property_id from imsld_roles roles, imsld_send_mail_data data, acs_rels, cr_items cr1, cr_items cr2, cr_items cr3 where object_id_one = cr1.item_id and cr1.latest_revision = :mail_id and rel_type = 'imsld_send_mail_serv_data_rel' and object_id_two = cr2.item_id and cr2.latest_revision = data_id and data.role_id = cr3.item_id and cr3.latest_revision = roles.role_id} {
+ db_foreach get_mail_data {select identifier, mail_data, email_property_id, username_property_id from imsld_roles roles, imsld_send_mail_data data, acs_rels, cr_items cr1, cr_items cr2, cr_items cr3 where object_id_one = cr1.item_id and cr1.latest_revision = :mail_id and rel_type = 'imsld_send_mail_serv_data_rel' and object_id_two = cr2.item_id and cr2.latest_revision = data_id and data.role_id = cr3.item_id and cr3.latest_revision = roles.role_id} {
#Write imsld:email-data label and content
set imsld_email_data [$doc createElement "imsld:email-data"]
$imsld_send_mail appendChild $imsld_email_data
@@ -962,19 +987,13 @@
$imsld_email_data appendChild $imsld_role_ref
#Add ref attribute
$imsld_role_ref setAttribute ref $identifier
-###################################################
-###################################################
-############# Under construction ##################
-###################################################
-# #Write imsld:email-property-ref label and content
-# set email_property_ref [$doc createElement "imsld:email-property-ref"]
-# $imsld_email_data appendChild $email_property_ref
+
+ #Write imsld:email-property-ref label and content
+ set email_property_ref [$doc createElement "imsld:email-property-ref"]
+ $imsld_email_data appendChild $email_property_ref
-# #Add ref attribute
-# $email_property_ref setAttribute ref $identifier
-###################################################
-###################################################
-###################################################
+ #Add ref attribute
+ $email_property_ref setAttribute ref $identifier
}
}
}
Index: openacs-4/packages/imsld/tcl/imsld-export-ld-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-export-ld-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/imsld/tcl/imsld-export-ld-procs.tcl 18 Feb 2009 11:10:46 -0000 1.1
+++ openacs-4/packages/imsld/tcl/imsld-export-ld-procs.tcl 17 Jun 2009 08:00:01 -0000 1.2
@@ -29,7 +29,13 @@
db_1row get_learning_objectives_info {select imsld_item_id, identifier, identifierref, is_visible_p from acs_rels, cr_items cr, imsld_items where :learning_objective_id = object_id_one and object_id_two = cr.item_id and cr.latest_revision = imsld_item_id}
#Add attributes of imsld:item label
$imsld_item setAttribute identifier $identifier
+ #Check if the reference is of a xowiki page, if it is the case, fill identifierref with resource_(resource_number)
+ if {[string first "item_" $identifier] == 0} {
+ set identifierref "resource_[string range $identifier [expr [string first "_" $identifier]+1] end]"
+ }
+
$imsld_item setAttribute identifierref $identifierref
+
if {$is_visible_p == "t"} {
set is_visible "true"
} else {
@@ -77,6 +83,10 @@
db_1row get_prerequisites_info {select imsld_item_id, identifier, identifierref, is_visible_p from acs_rels, cr_items cr, imsld_items where :prerequisite_id = object_id_one and object_id_two = cr.item_id and cr.latest_revision = imsld_item_id}
#Add attributes of imsld:item label
$imsld_item setAttribute identifier $identifier
+ #Check if the reference is of a xowiki page, if it is the case, fill identifierref with resource_(resource_number)
+ if {[string first "item_" $identifier] == 0} {
+ set identifierref "resource_[string range $identifier [expr [string first "_" $identifier]+1] end]"
+ }
$imsld_item setAttribute identifierref $identifierref
if {$is_visible_p == "t"} {
set is_visible "true"
Index: openacs-4/packages/imsld/tcl/imsld-export-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-export-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/imsld/tcl/imsld-export-procs.tcl 18 Feb 2009 11:10:46 -0000 1.1
+++ openacs-4/packages/imsld/tcl/imsld-export-procs.tcl 17 Jun 2009 08:00:01 -0000 1.2
@@ -5,6 +5,7 @@
###############################################################################
ad_proc -public imsld::export::uol {
-run_imsld_id:required
+ -resource_list:required
} {
This proc is called when an UoL is needed to be exported
} {
@@ -31,7 +32,7 @@
imsld::export::write_organizations -doc $doc -manifest $root -manifest_id $manifest_id -imsld_id $run_imsld_id -learning_objective_id $learning_objective_id -prerequisite_id $prerequisite_id
#Call proc to fill resources part of imsmanifest.xml
- imsld::export::write_resources -doc $doc -manifest $root -manifest_id $manifest_id
+ imsld::export::write_resources -doc $doc -manifest $root -manifest_id $manifest_id -resource_list $resource_list
#Return the document as xml
$root asXML
@@ -79,9 +80,9 @@
} {
This proc is called to write metadata label and content
} {
- ###################################
- # This is not implemented
- ###################################
+ ##############################################################
+ # This is not implemented due to it is not supported in Grail
+ ##############################################################
#Not stored in grail
#set metadata [$doc createElement metadata]
#$metadata appendChild [$doc createTextNode "Estoy en funcion write_metadata"]
@@ -116,16 +117,15 @@
-doc:required
-manifest:required
-manifest_id:required
+ -resource_list:required
} {
This proc is called to write resources label and content
} {
#First, create resources label
set resources [$doc createElement resources]
$manifest appendChild $resources
-
#Get resources and write them into the manifest document
db_multirow get_resources get_resources {select * from imsld_cp_resources where manifest_id = :manifest_id} {
- if {$href != ""} {
#First, I need to create a resource label
set resource [$doc createElement "resource"]
$resources appendChild $resource
@@ -134,10 +134,22 @@
$resource setAttribute identifier $identifier
}
$resource setAttribute type $type
- $resource setAttribute href $href
+ if {$href != ""} {
+ $resource setAttribute href $href
+ }
+ #Check resource_list to look for additional resource files to the ones referenced in the database
+ if {[lindex $resource_list 0] == "NONE" || $href == ""} {
+ set resource_files_list [list]
+ } else {
+ set position [lsearch $resource_list $href]
+ if {$position != -1} {
+ set resource_files_list [lindex $resource_list [expr $position+1]]
+ } else {
+ set resource_files_list [list]
+ }
+ }
#Call proc to fill files information for the resource
- imsld::export::write_files -doc $doc -resource $resource -resource_id $resource_id
- }
+ imsld::export::write_files -doc $doc -resource $resource -resource_id $resource_id -resource_files_list $resource_files_list
}
}
@@ -148,20 +160,53 @@
-doc:required
-resource:required
-resource_id:required
+ -resource_files_list:required
} {
This proc is called to write files label and content
} {
#Get file_ids of the resource given
db_multirow get_file_ids get_file_ids {select object_id_two from acs_rels where object_id_one = cr_items.item_id and cr_items.latest_revision = :resource_id} {
- #Get href for each file returned in the get_files_ids query
- if {[db_0or1row get_file_href {select href from imsld_cp_files where imsld_file_id = cr_items.latest_revision and cr_items.item_id = :object_id_two}] == 1} {
- #Create file label
- set one_file [$doc createElement "file"]
- $resource appendChild $one_file
- #Add href attribute
- $one_file setAttribute href $href
+ #Get content type to proceed depending on type (imsld_cp_file, ::xowiki::Page or ::xowiki::File)
+ db_1row get_content_type {select content_type, name from cr_items where item_id = :object_id_two}
+
+ if {$content_type == "imsld_cp_file"} {
+ #Get href for each file returned in the get_files_ids query
+ if {[db_0or1row get_file_href {select href from imsld_cp_files where imsld_file_id = cr_items.latest_revision and cr_items.item_id = :object_id_two}] == 1} {
+ #Create file label
+ set one_file [$doc createElement "file"]
+ $resource appendChild $one_file
+ #Add href attribute
+ $one_file setAttribute href ${href}
+ }
+ } else {
+ if {[string first "link" $name] != 0} {
+ #Create file label
+ set one_file [$doc createElement "file"]
+ $resource appendChild $one_file
+
+ set pos [string first "/" $name]
+ if {$pos == -1} {
+ regsub -all {:} $name {_} name
+ if {[string last "." $name] < [string length $name]-5} {
+ set name ${name}.html
+ }
+ }
+ set href [string range $name [expr $pos+1] end]
+
+ #Add href attribute
+ $one_file setAttribute href ${href}
+ }
}
}
+ #Write file resources from resource_file_list
+ if {[llength $resource_files_list] > 0} {
+ foreach res_file $resource_files_list {
+ set one_file [$doc createElement "file"]
+ $resource appendChild $one_file
+ #Add href attribute
+ $one_file setAttribute href ${res_file}
+ }
+ }
}
###############################################################################
Index: openacs-4/packages/imsld/tcl/imsld-fs-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-fs-procs.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/imsld/tcl/imsld-fs-procs.tcl 17 Apr 2008 17:18:16 -0000 1.7
+++ openacs-4/packages/imsld/tcl/imsld-fs-procs.tcl 17 Jun 2009 08:00:01 -0000 1.8
@@ -252,6 +252,7 @@
ad_proc -public imsld::fs::traverse_zip {
-dir:required
-pattern:required
+ {-resource_handler "file-storage"}
} {
Function to recursively traverse the files in a ZIP to then detect those
that are not reerenced in a resource, but still need to be in the file
@@ -266,16 +267,23 @@
-file_list $files_struct_list \
-path_prefix $dir] } {
# Create the new file
- imsld::fs::file_new \
- -path_to_file $fname \
- -type file \
- -complete_path "[ns_urldecode ${dir}/${fname}]"
+ if {$resource_handler eq "file-storage"} {
+ imsld::fs::file_new \
+ -path_to_file $fname \
+ -type file \
+ -complete_path "[ns_urldecode ${dir}/${fname}]"
+ } else {
+ imsld::xowiki::file_new \
+ -path_to_file $fname \
+ -type file \
+ -complete_path "[ns_urldecode ${dir}/${fname}]"
+ }
}
}
# Recur over the directories
foreach subd [glob -tail -nocomplain -types d -directory $dir $pattern] {
- imsld::fs::traverse_zip -dir $dir -pattern "$subd/*"
+ imsld::fs::traverse_zip -dir $dir -pattern "$subd/*" -resource_handler $resource_handler
}
}
@@ -300,7 +308,7 @@
if { [lsearch -exact [string tolower $content] \
[string tolower "$path_prefix/$file_name"]] >=0 && \
[lindex $content 1] eq "file" } {
- # If the object_id is zero, the file was found
+ # If the object_id is zero, the file was not found
if { [lindex $content 2] == 0 } {
return 1
} else {
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.47 -r1.48
--- openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 18 Dec 2008 19:12:13 -0000 1.47
+++ openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 17 Jun 2009 08:00:01 -0000 1.48
@@ -121,7 +121,7 @@
content::type::attribute::new -content_type imsld_activity_structure -attribute_name sort_order -datatype number -pretty_name "#imsld.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
+ content::type::new -content_type imsld_environment -supertype content_revision -pretty_name "#imsld.IMS-LD_Environment#" -pretty_plural "#imsld.IMS-LD_Environments#" -table_name imsld_environments -id_column environment_id
content::type::attribute::new -content_type imsld_environment -attribute_name component_id -datatype number -pretty_name "#imsld.Component_Identifier#" -column_spec "integer"
content::type::attribute::new -content_type imsld_environment -attribute_name identifier -datatype string -pretty_name "#imsld.Identifier#" -column_spec "varchar(100)"
@@ -208,7 +208,7 @@
# on completion
content::type::new -content_type imsld_on_completion -supertype content_revision -pretty_name "#imsld.IMS-LD_On_Completion#" -pretty_plural "#imsld.lt_IMS-LD_On_Completions#" -table_name imsld_on_completion -id_column on_completion_id
- content::type::attribute::new -content_type imsld_on_completion -attribute_name feedback_title -datatype string -pretty_name "#imsld.Feedbach_Title#" -column_spec "varchar(200)"
+ content::type::attribute::new -content_type imsld_on_completion -attribute_name feedback_title -datatype string -pretty_name "#imsld.Feedback_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
@@ -247,7 +247,7 @@
content::type::attribute::new -content_type imsld_cp_dependency -attribute_name identifierref -datatype string -pretty_name "#imsld.Identifierref#" -column_spec "varchar(100)"
# imsld cp files
- content::type::new -content_type imsld_cp_file -supertype content_revision -pretty_name "#imsld.IMS-LD_CP_File#" -pretty_plural "#imsld.IMS-LD_CP_Filed#" -table_name imsld_cp_files -id_column imsld_file_id
+ content::type::new -content_type imsld_cp_file -supertype content_revision -pretty_name "#imsld.IMS-LD_CP_File#" -pretty_plural "#imsld.IMS-LD_CP_Files#" -table_name imsld_cp_files -id_column imsld_file_id
content::type::attribute::new -content_type imsld_cp_file -attribute_name path_to_file -datatype string -pretty_name "#imsld.Path_to_File#" -column_spec "varchar(2000)"
content::type::attribute::new -content_type imsld_cp_file -attribute_name file_name -datatype string -pretty_name "#imsld.File_name#" -column_spec "varchar(2000)"
@@ -322,6 +322,9 @@
content::type::attribute::new -content_type imsld_condition -attribute_name method_id -datatype number -pretty_name "#imsld.Method_Identifier#" -column_spec "integer"
content::type::attribute::new -content_type imsld_condition -attribute_name condition_xml -datatype string -pretty_name "#imsld.Condition#" -column_spec "varchar(4000)"
+ # global properties folder
+ imsld::install::create_global_folder
+
### IMS-LD LEVEL C
# notifications
@@ -1083,6 +1086,7 @@
content::type::attribute::delete -content_type imsld_imsld -attribute_name sequence_used_p
content::type::attribute::delete -content_type imsld_imsld -attribute_name learning_objective_id
content::type::attribute::delete -content_type imsld_imsld -attribute_name prerequisite_id
+ content::type::attribute::delete -content_type imsld_imsld -attribute_name resource_handler
# learning objectives
content::type::attribute::delete -content_type imsld_learning_objective -attribute_name pretty_title
@@ -1205,6 +1209,7 @@
# complete acts
content::type::attribute::delete -content_type imsld_complete_act -attribute_name time_in_seconds
+ content::type::attribute::delete -content_type imsld_complete_act -attribute_name time_string
content::type::attribute::delete -content_type imsld_complete_act -attribute_name user_choice_p
content::type::attribute::delete -content_type imsld_complete_act -attribute_name when_last_act_completed_p
@@ -1297,3 +1302,52 @@
}
+
+ad_proc -private imsld::install::create_global_folder {
+} {
+ Creates the CR folder for global properties
+
+ @author Derick Leony (derick@inv.it.uc3m.es)
+ @creation-date 2009-05-28
+
+ @return
+
+ @error
+} {
+ set folder_name "imsld_global_folder"
+ set dotlrn_root_folder_id [dotlrn_fs::get_dotlrn_root_folder_id]
+
+ db_transaction {
+ # create the root cr dir
+
+ set global_folder_id [imsld::cr::folder_new \
+ -parent_id $dotlrn_root_folder_id \
+ -folder_name $folder_name \
+ -folder_label "IMS-LD"]
+
+ # PERMISSIONS FOR FILE-STORAGE
+
+ # Before we go about anything else, lets just set permissions
+ # straight.
+ # Disable folder permissions inheritance
+ permission::set_not_inherit -object_id $global_folder_id
+
+ # Set read permissions for *all* other professors within .LRN
+ # (so they can see the content)
+ set party_id_professor [dotlrn::user::type::get_segment_id -type professor]
+ permission::grant -party_id $party_id_professor -object_id $global_folder_id -privilege read
+
+ # Set read permissions for *all* other admins within .LRN
+ # (so they can see the content)
+ set party_id_admins [dotlrn::user::type::get_segment_id -type admin]
+ permission::grant -party_id $party_id_admins -object_id $global_folder_id -privilege read
+ }
+ # register content types
+ content::folder::register_content_type -folder_id $global_folder_id \
+ -content_type imsld_property_instance
+
+ # allow subfolders inside our parent folder
+ content::folder::register_content_type -folder_id $global_folder_id \
+ -content_type content_folder
+}
+
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.15 -r1.16
--- openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl 4 Jul 2008 15:29:26 -0000 1.15
+++ openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl 17 Jun 2009 08:00:01 -0000 1.16
@@ -191,14 +191,24 @@
# before we can continue we create the folder where the properties of type
# file will be stored
set run_folder_id [imsld::instance::create_run_folder -run_id $run_id]
+ set community_id [dotlrn_community::get_community_id]
set cr_root_folder_id \
[imsld::cr::get_root_folder \
- -community_id [dotlrn_community::get_community_id]]
+ -community_id $community_id]
set cr_folder_id [content::item::get_id \
-item_path "cr_manifest_${manifest_id}" \
-root_folder_id $cr_root_folder_id -resolve_index f]
set global_folder_id [imsld::global_folder_id]
+ # Set read permissions for community/class dotlrn_member_rel
+ set party_id_member [dotlrn_community::get_rel_segment_id -community_id $community_id -rel_type dotlrn_member_rel]
+ permission::grant -party_id $party_id_member -object_id $global_folder_id -privilege read
+
+ # Set read permissions for community/class dotlrn_admin_rel
+ set party_id_admin [dotlrn_community::get_rel_segment_id -community_id $community_id -rel_type dotlrn_admin_rel]
+ permission::grant -party_id $party_id_admin -object_id $global_folder_id -privilege read
+
+
# 1. loc-property: We create only one entry in the imsld_property_instances
# table for each property of this type
db_foreach loc_property {
@@ -886,6 +896,11 @@
}
}
+ #5.5 Generic Service (GSI)
+ #in another file, to ensure an non-intrussive add-on (as much as possible)
+ imsld::gsi::instance::instantiate_service -component_item_id $component_item_id -run_id $run_id -user_id $user_id
+
+
# 6. play
db_foreach play {
select play.play_id,
Index: openacs-4/packages/imsld/tcl/imsld-monitor-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-monitor-procs.tcl,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/imsld/tcl/imsld-monitor-procs.tcl 5 Feb 2009 17:18:18 -0000 1.9
+++ openacs-4/packages/imsld/tcl/imsld-monitor-procs.tcl 17 Jun 2009 08:00:01 -0000 1.10
@@ -129,6 +129,21 @@
-sort_order $sort_order \
-number_elements $activities_number]
+ set del_node [$dom_doc createElement a]
+ $del_node setAttribute onclick "return loadTree('[export_vars -base activity-del {run_id activity_id}]')"
+ $del_node setAttribute href "#no"
+ $del_node setAttribute title "[_ imsld.Delete_URL]"
+
+ set del_icon [$dom_doc createElement img]
+ $del_node appendChild $del_icon
+ $del_icon setAttribute src "/resources/acs-subsite/Delete16.gif"
+ $del_icon setAttribute alt "[_ imsld.Delete]"
+
+ $del_node appendChild $del_icon
+ $activity_node appendChild [$dom_doc createTextNode " \["]
+ $activity_node appendChild $del_node
+ $activity_node appendChild [$dom_doc createTextNode "]"]
+
set completed_list [linsert $completed_list \
$sort_order [$activity_node asList]]
}
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.75 -r1.76
--- openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 19 Dec 2008 18:57:01 -0000 1.75
+++ openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 17 Jun 2009 08:00:01 -0000 1.76
@@ -264,7 +264,7 @@
} elseif { [regexp {.zip$} $upload_file] } {
set type zip
} else {
- set type "[_ imsld.Uknown_type]"
+ set type "[_ imsld.Unknown_type]"
}
switch $type {
@@ -533,6 +533,7 @@
-community_id:required
-manifest_id:required
{-manifest_identifier ""}
+ {-resource_handler "file-storage"}
} {
Initializes the cr folders where all the cr items of the manifest will be stored in, and sets the respective permissions. There are two folders for each imsld. One to store the files and show them in the fs, and the other to store the items..
It won't create the files in the cr since not every file will be handled by the cr (some files may be handled by other packages).
@@ -564,7 +565,7 @@
set fs_folder_id [content::item::get_id -item_path "manifest_${manifest_id}" -root_folder_id $fs_root_folder_id -resolve_index f]
set cr_folder_id [content::item::get_id -item_path "cr_manifest_${manifest_id}" -root_folder_id $cr_root_folder_id -resolve_index f]
- if { [empty_string_p $fs_folder_id] } {
+ if { [empty_string_p $fs_folder_id] && ($resource_handler eq "file-storage") } {
db_transaction {
set folder_name "manifest_${manifest_id}"
@@ -721,6 +722,11 @@
permission::set_not_inherit -object_id $acs_object_id
}
+ set import_with_xowiki 0
+ if { $resource_handler eq "xowiki" } {
+ set import_with_xowiki 1
+ }
+
set resource_id [imsld::cp::resource_new -manifest_id $manifest_id \
-identifier $resource_identifier \
-type $resource_type \
@@ -733,11 +739,6 @@
set filex_list [$resource_node selectNodes {*[local-name()='file']}]
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]
@@ -750,7 +751,7 @@
-type file \
-complete_path "[ns_urldecode ${tmp_dir}/${filex_href}]"]
} else {
- set filex_id [imsld::fs::file_new -href $filex_href \
+ set filex_id [imsld::fs::file_new -href $filex_href \
-path_to_file $filex_href \
-type file \
-complete_path "[ns_urldecode ${tmp_dir}/${filex_href}]"]
@@ -2203,6 +2204,22 @@
}
}
+
+# GSI integration: support for generic services
+# environment: genericService
+ set gsi_services [$environment_node selectNodes "*\[local-name()='genericService'\]"]
+ foreach gservice $gsi_services {
+ set gsi_service_id [imsld::gsi::parse::parse_and_create_genericService -service_node $gservice \
+ -environment_id $environment_id \
+ -parent_id $parent_id \
+ -manifest_id $manifest_id \
+ -manifest $manifest \
+ -tmp_dir $tmp_dir \
+ -resource_handler $resource_handler \
+ ]
+ }
+
+
# environment: environment ref
set environment_ref_list [$environment_node selectNodes "*\[local-name()='environment-ref'\]"]
if { [llength $environment_ref_list] } {
@@ -2499,8 +2516,10 @@
# create a node where all the change-property-values will be stored
set temporal_doc [dom createDocument change-property-values]
set temporal_node [$temporal_doc documentElement]
-
- $temporal_node appendChild $change_property_value_list
+
+ foreach cpv $change_property_value_list {
+ $temporal_node appendChild $cpv
+ }
set change_property_value_xml [$temporal_node asXML]
}
@@ -2720,8 +2739,10 @@
# create a node where all the change-property-values will be stored
set temporal_doc [dom createDocument change-property-values]
set temporal_node [$temporal_doc documentElement]
-
- $temporal_node appendChild $change_property_value_list
+
+ foreach cpv $change_property_value_list {
+ $temporal_node appendChild $cpv
+ }
set change_property_value_xml [$temporal_node asXML]
}
@@ -3600,8 +3621,9 @@
# create a node where all the change-property-values will be stored
set temporal_doc [dom createDocument change-property-values]
set temporal_node [$temporal_doc documentElement]
-
- $temporal_node appendChild $change_property_value_list
+ foreach cpv $change_property_value_list {
+ $temporal_node appendChild $cpv
+ }
set change_property_value_xml [$temporal_node asXML]
}
@@ -3810,8 +3832,10 @@
# create a node where all the change-property-values will be stored
set temporal_doc [dom createDocument change-property-values]
set temporal_node [$temporal_doc documentElement]
-
- $temporal_node appendChild $change_property_value_list
+
+ foreach cpv $change_property_value_list {
+ $temporal_node appendChild $cpv
+ }
set change_property_value_xml [$temporal_node asXML]
}
@@ -4234,9 +4258,10 @@
# initialize folders
set folders_list [imsld::parse::initialize_folders -community_id $community_id \
- -manifest_id $manifest_id \
- -manifest_identifier $manifest_identifier]
-
+ -manifest_id $manifest_id \
+ -manifest_identifier $manifest_identifier \
+ -resource_handler $resource_handler]
+
set fs_folder_id [lindex $folders_list 0]
set cr_folder_id [lindex $folders_list 1]
@@ -4552,8 +4577,10 @@
# create a node where all the change-property-values will be stored
set temporal_doc [dom createDocument change-property-values]
set temporal_node [$temporal_doc documentElement]
-
- $temporal_node appendChild $change_property_value_list
+
+ foreach cpv $change_property_value_list {
+ $temporal_node appendChild $cpv
+ }
set change_property_value_xml [$temporal_node asXML]
}
@@ -4820,7 +4847,7 @@
# them. Those that still have a zero as object_id are files that are not
# referenced as resources by the manifest, but they are in the ZIP,
# therefore, they need to be moved to the FS.
- imsld::fs::traverse_zip -dir $tmp_dir -pattern "*"
+ imsld::fs::traverse_zip -dir $tmp_dir -pattern "*" -resource_handler $resource_handler
if { ![empty_string_p $warnings] } {
set warnings "[_ imsld.lt_br__Warnings_ul_warni]"
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.116 -r1.117
--- openacs-4/packages/imsld/tcl/imsld-procs.tcl 27 Mar 2009 03:22:41 -0000 1.116
+++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 17 Jun 2009 08:00:01 -0000 1.117
@@ -668,63 +668,13 @@
This folder is a subfolder of the dotlrn root folder and there must be only
one in the .LRN installation
} {
- set community_id [expr { [empty_string_p $community_id] ? \
- [dotlrn_community::get_community_id] : \
- $community_id }]
-
set dotlrn_root_folder_id [dotlrn_fs::get_dotlrn_root_folder_id]
+
set global_folder_id [content::item::get_id \
-item_path "imsld_global_folder" \
-root_folder_id $dotlrn_root_folder_id \
-resolve_index f]
- if { [empty_string_p $global_folder_id] } {
- db_transaction {
- set folder_name "imsld_global_folder"
-
- # checks for write permission on the parent folder
- ad_require_permission $dotlrn_root_folder_id write
-
- # create the root cr dir
-
- set global_folder_id [imsld::cr::folder_new \
- -parent_id $dotlrn_root_folder_id \
- -folder_name $folder_name \
- -folder_label "IMS-LD"]
-
- # PERMISSIONS FOR FILE-STORAGE
-
- # Before we go about anything else, lets just set permissions
- # straight.
- # Disable folder permissions inheritance
- permission::toggle_inherit -object_id $global_folder_id
-
- # Set read permissions for community/class dotlrn_member_rel
- set party_id_member [dotlrn_community::get_rel_segment_id -community_id $community_id -rel_type dotlrn_member_rel]
- permission::grant -party_id $party_id_member -object_id $global_folder_id -privilege read
-
- # Set read permissions for community/class dotlrn_admin_rel
- set party_id_admin [dotlrn_community::get_rel_segment_id -community_id $community_id -rel_type dotlrn_admin_rel]
- permission::grant -party_id $party_id_admin -object_id $global_folder_id -privilege read
-
- # Set read permissions for *all* other professors within .LRN
- # (so they can see the content)
- set party_id_professor [dotlrn::user::type::get_segment_id -type professor]
- permission::grant -party_id $party_id_professor -object_id $global_folder_id -privilege read
-
- # Set read permissions for *all* other admins within .LRN
- # (so they can see the content)
- set party_id_admins [dotlrn::user::type::get_segment_id -type admin]
- permission::grant -party_id $party_id_admins -object_id $global_folder_id -privilege read
- }
- # register content types
- content::folder::register_content_type -folder_id $global_folder_id \
- -content_type imsld_property_instance
-
- # allow subfolders inside our parent folder
- content::folder::register_content_type -folder_id $global_folder_id \
- -content_type content_folder
- }
return $global_folder_id
}
@@ -1228,6 +1178,7 @@
set url [ns_conn url]
regexp {finish-component-element-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([a-z]+).imsld$} $url match imsld_id run_id play_id act_id role_part_id element_id type
}
+ ns_log Notice "finish_component element: act_id ($act_id), role_part_id ($role_part_id), user_id ($user_id)"
if { ![db_0or1row marked_as_started { *SQL* }] } {
# NOTE: this should not happen... UNLESS the activity is marked as
# finished automatically
@@ -1283,7 +1234,8 @@
and content_revision__is_live(on_completion_id) = 't'
and change_property_value_xml is not null
}] } {
- imsld::condition::eval_change_property_value -change_property_value_xml $change_property_value_xml -run_id $run_id
+ ns_log Notice "->eval: $user_id"
+ imsld::condition::eval_change_property_value -change_property_value_xml $change_property_value_xml -run_id $run_id -user_id $user_id
}
# notifications
set notified_users_list [list]
@@ -1337,6 +1289,14 @@
}
}
}
+ #FIXME: on-complete-actions are only defined form acts, because all users finish the component at the
+ #same time. I have to define the behaviour for other components.
+ #look for matching gsi_triggers
+ set action_list [imsld::gsi::get_triggered_actions -trigger "on-complete-action" -run_id $run_id]
+ #FIXME: hay que restringir la lista a las acciones que apuntan al component actual
+ if {[llength $action_list]} {
+ imsld::gsi::action_list_execute -actions $action_list -run_id $run_id
+ }
}
if { [string eq $type "learning"] || [string eq $type "support"] || [string eq $type "structure"] } {
@@ -2171,7 +2131,7 @@
lappend resource_item_list $resource_item_id
set monitor_node_li [$dom_doc createElement li]
set a_node [$dom_doc createElement a]
- set file_url [export_vars -base "[dotlrn_community::get_community_url [dotlrn_community::get_community_id]]imsld/monitor-frame" { monitor_id }]
+ set file_url [export_vars -base "[dotlrn_community::get_community_url [dotlrn_community::get_community_id]]imsld/monitor-frame" { monitor_id role_id}]
$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}]
set service_title [$dom_doc createTextNode "$monitor_service_title"]
$a_node appendChild $service_title
@@ -2302,6 +2262,13 @@
}
}
+#gsi generic services
+ set environment_gservices_list [imsld::gsi::find_and_process_gsi_service_as_ul -environment_id $environment_id \
+ -user_id $user_id \
+ -run_id $run_id \
+ -dom_node $environment_node \
+ -dom_doc $dom_doc]
+
set nested_environment_list [list]
# environments
foreach nested_environment_item_id [db_list nested_environment { *SQL* }] {
@@ -2371,7 +2338,7 @@
imsld::process_resource_as_ul -resource_item_id $resource_item_id \
-run_id $run_id \
-dom_doc $dom_doc \
- -dom_node $list_node
+ -dom_node $dom_node
} if_no_rows {
ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]"
}
@@ -4472,6 +4439,7 @@
imsld_activity_descsi ades
where ades.item_id = :object_id_nested
and la.activity_description_id = ades.item_id
+ and content_revision__is_live(la.activity_id)
}] } {
set activities_list [concat $activities_list [list [list $activity_id $activity_item_id learning]]]
} else {
@@ -4719,17 +4687,7 @@
#get the user active role
- db_1row get_active_role {
- select iruns.active_role_id as active_role
- from imsld_run_users_group_rels iruns,
- acs_rels ar,
- imsld_run_users_group_ext iruge
- where iruge.run_id=:run_id
- and ar.object_id_one=iruge.group_id
- and ar.object_id_two=:user_id
- and ar.rel_type='imsld_run_users_group_rel'
- and ar.rel_id=iruns.rel_id
- }
+ set active_role [imsld::roles::get_active_role -run_id $run_id -user_id $user_id]
#get the permissions related to that role
set manager_in_forum 0
@@ -4951,6 +4909,40 @@
}
}
+ad_proc -public imsld::get_imsld_cp_file_id {
+ -run_id
+ -identifier
+} {
+ Return the imsld_file_id (cr_item_id, in fact) related with an identifier and a run_id
+ @author Luis de la Fuente Valentín (lfuente@it.uc3m.es)
+} {
+ set imsld_file_id ""
+ if { [db_0or1row get_resource_from_identifier {
+ select icr.item_id as resource_item_id
+ from imsld_runs ir,
+ imsld_imslds ii,
+ imsld_cp_organizationsi ico,
+ imsld_cp_manifestsi icm,
+ imsld_cp_resourcesi icr
+ where ir.imsld_id=ii.imsld_id and
+ ii.organization_id=ico.item_id and
+ ir.run_id=:run_id and
+ ico.manifest_id=icm.item_id and
+ icm.item_id=icr.manifest_id and
+ icr.identifier=:identifier
+ }]} {
+ # get file info from resource
+ set imsld_file_id [db_string get_file_from_resource {
+ select ar.object_id_two as imsld_file_id
+ from acs_rels ar
+ where ar.rel_type ='imsld_res_files_rel' and
+ ar.object_id_one=:resource_item_id
+ } -default ""]
+ }
+ return "$imsld_file_id"
+}
+
+
ad_register_proc GET /finish-component-element* imsld::finish_component_element
ad_register_proc POST /finish-component-element* imsld::finish_component_element
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.18 -r1.19
--- openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl 2 Dec 2008 17:26:35 -0000 1.18
+++ openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl 17 Jun 2009 08:00:01 -0000 1.19
@@ -158,8 +158,12 @@
} {
@param roles_list the list of roles to get the name
} {
- if {[info exist run_id]} {
- set groups [db_list get_community_related_groups {}]
+ if {[exists_and_not_null run_id]} {
+ if {[exists_and_not_null role_id]} {
+ set groups [db_list get_community_role_related_groups {}]
+ } else {
+ set groups [db_list get_community_related_groups {}]
+ }
} else {
set groups [db_list get_related_groups {}]
}
@@ -467,3 +471,24 @@
return $groups
}
+
+ad_proc -public imsld::roles::get_active_role {
+ -run_id:required
+ -user_id:required
+} {
+ Return the active role for a given user in a given run.
+} {
+ db_1row get_active_role {
+ select iruns.active_role_id as active_role
+ from imsld_run_users_group_rels iruns,
+ acs_rels ar,
+ imsld_run_users_group_ext iruge
+ where iruge.run_id=:run_id
+ and ar.object_id_one=iruge.group_id
+ and ar.object_id_two=:user_id
+ and ar.rel_type='imsld_run_users_group_rel'
+ and ar.rel_id=iruns.rel_id
+ }
+ return $active_role
+}
+
Index: openacs-4/packages/imsld/tcl/imsld-roles-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-roles-procs.xql,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/imsld/tcl/imsld-roles-procs.xql 18 Apr 2008 14:42:32 -0000 1.6
+++ openacs-4/packages/imsld/tcl/imsld-roles-procs.xql 17 Jun 2009 08:00:01 -0000 1.7
@@ -139,7 +139,7 @@
-
+
select ar.object_id_two
from acs_rels ar,
@@ -156,6 +156,22 @@
+
+
+ select ar.object_id_two
+ from acs_rels ar,
+ acs_rels ar2,
+ imsld_rolesi iri,
+ imsld_run_users_group_ext iruge
+ where ar.object_id_one=iri.item_id
+ and ar.rel_type='imsld_role_group_rel'
+ and ar.object_id_two=ar2.object_id_one
+ and ar2.rel_type='imsld_roleinstance_run_rel'
+ and ar2.object_id_two=iruge.group_id
+ and iruge.run_id=:run_id
+
+
+
select ar.object_id_two
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.3 -r1.4
--- openacs-4/packages/imsld/tcl/imsld-xowiki-procs.tcl 19 Dec 2008 18:57:01 -0000 1.3
+++ openacs-4/packages/imsld/tcl/imsld-xowiki-procs.tcl 17 Jun 2009 08:00:01 -0000 1.4
@@ -37,7 +37,37 @@
@error
} {
+ upvar files_struct_list files_struct_list
+ # search the file and while doing so, create all the parent folders for that file (if they were not already creatd)
+ set found_p 0
+
+ # structx = directory loop, count_y and count_x are going to be used to update the files_structure_list
+ set structx $files_struct_list
+ set count_y 0
+ while { [llength $structx] > 0 && $found_p == 0 } {
+ # for each directory
+ set dirx [lindex $structx 0]
+ set count_x 0
+ # search in the dir contents
+ foreach contentsx [lindex $dirx 1] {
+ if { [lsearch -exact [string tolower $contentsx] [string tolower $complete_path]] >= 0 && [string eq [lindex $contentsx 1] $type] } {
+ # file found, see if the parent dir is created
+ set found_p 1
+ # have we already created this file?
+ set found_id [lindex $contentsx 2]
+ set parent_id [lindex [lindex $dirx 0] 1]
+ break
+ }
+ incr count_x
+ }
+ if { !$found_p } {
+ # proceed only if the file hasn't been found, since we will use the counter later
+ incr count_y
+ set structx [lrange $structx 1 [expr [llength $structx] -1]]
+ }
+ }
+
set mime_type [cr_filename_to_mime_type $complete_path]
set community_id [dotlrn_community::get_community_id]
@@ -48,7 +78,7 @@
::xowiki::Package initialize -package_id $package_id -url $xw_url -user_id [ad_conn user_id]
- if { [string match "text/*" $mime_type] } {
+ if { $mime_type eq "text/html" || $mime_type eq "text/xml" } {
set file [open $complete_path]
set content [read $file]
close $file
@@ -93,6 +123,13 @@
$page save
}
}
+ # update file structure
+ if { $found_p } {
+ set file_list [list $complete_path file [$page item_id]]
+ set content_list [lreplace [lindex [lindex $files_struct_list $count_y] 1] $count_x $count_x $file_list]
+ set dir_list [list [lindex [lindex $files_struct_list $count_y] 0] $content_list]
+ set files_struct_list [lreplace $files_struct_list $count_y $count_y $dir_list]
+ }
return [$page item_id]
@@ -101,6 +138,7 @@
ad_proc -public imsld::xowiki::page_content {
-item_id
+ -run_id
} {
@author Derick Leony (derick@inv.it.uc3m.es)
@@ -113,8 +151,19 @@
@error
} {
set page [::xowiki::Package instantiate_page_from_id -item_id $item_id]
- set result [$page render]
+ set result [$page render_content]
+ set manifest_identifier [db_string select_identifier {
+ select im.identifier
+ from imsld_cp_manifestsx im, imsld_cp_organizationsx io, imsld_imslds ii, imsld_runs ir
+ where ir.run_id = :run_id
+ and ir.imsld_id = ii.imsld_id
+ and ii.organization_id = io.item_id
+ and io.manifest_id = im.item_id
+ } -default ""]
+
+ regsub {src="([^\"]*)"} $result "src=\"../xowiki/download/file/${manifest_identifier}/\\1\"" result
+
return $result
}
Index: openacs-4/packages/imsld/www/activity-frame.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/activity-frame.adp,v
diff -u -r1.18 -r1.19
--- openacs-4/packages/imsld/www/activity-frame.adp 27 Apr 2009 10:02:07 -0000 1.18
+++ openacs-4/packages/imsld/www/activity-frame.adp 17 Jun 2009 08:00:01 -0000 1.19
@@ -1,16 +1,21 @@
-
- init_activity()
-
-
-
- 1
-
- @page_title;noquote@
- @context;noquote@
- 1
-
@environments;noquote@
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.26 -r1.27
--- openacs-4/packages/imsld/www/imsld-content-serve.tcl 8 Jan 2009 19:48:35 -0000 1.26
+++ openacs-4/packages/imsld/www/imsld-content-serve.tcl 17 Jun 2009 08:00:01 -0000 1.27
@@ -74,7 +74,7 @@
and map.displayable_p = 't'
}
- set xml_string "[imsld::xowiki::page_content -item_id $item_id]"
+ set xml_string "[imsld::xowiki::page_content -item_id $item_id -run_id $run_id]"
}
# context info
Index: openacs-4/packages/imsld/www/imsld-divset.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-divset.adp,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/imsld/www/imsld-divset.adp 27 Apr 2009 10:02:07 -0000 1.5
+++ openacs-4/packages/imsld/www/imsld-divset.adp 17 Jun 2009 08:00:01 -0000 1.6
@@ -1,28 +1,19 @@
-
-
-
-
- @course_name@
-
-
-
+
+ @course_name@
+ 1
+ init_activity()
+
+
+
+ 1
+
+
@@ -36,5 +27,3 @@
-
-
Index: openacs-4/packages/imsld/www/imsld-divset.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-divset.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/imsld/www/imsld-divset.tcl 8 Jul 2008 15:32:34 -0000 1.2
+++ openacs-4/packages/imsld/www/imsld-divset.tcl 17 Jun 2009 08:00:01 -0000 1.3
@@ -25,3 +25,5 @@
set environment_src [export_vars -base "environment-frame" {{run_id $run_id} {activity_id $activity_id}}]
}
+set page_title {}
+set context [list]
Index: openacs-4/packages/imsld/www/imsld-tree.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-tree.adp,v
diff -u -r1.19 -r1.20
--- openacs-4/packages/imsld/www/imsld-tree.adp 29 Mar 2009 15:27:40 -0000 1.19
+++ openacs-4/packages/imsld/www/imsld-tree.adp 17 Jun 2009 08:00:01 -0000 1.20
@@ -1,6 +1,3 @@
-