Index: openacs-4/packages/imsld/sql/postgresql/imsld-cp-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-cp-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/sql/postgresql/imsld-cp-create.sql 5 Aug 2005 15:25:33 -0000 1.1 +++ openacs-4/packages/imsld/sql/postgresql/imsld-cp-create.sql 4 Oct 2005 13:45:40 -0000 1.2 @@ -101,15 +101,10 @@ on delete cascade constraint imsld_cp_files_pk primary key, - resource_id integer - constraint imsld__file_res_id_fk - references cr_items, - path_to_file varchar(2000), + path_to_file varchar(2000), file_name varchar(2000), href varchar(2000) ); --- create index for imsld_cp_files -create index imsld_cp_files_res_id_idx on imsld_cp_files(resource_id); 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.5 -r1.6 --- openacs-4/packages/imsld/sql/postgresql/imsld-create.sql 27 Sep 2005 11:05:08 -0000 1.5 +++ openacs-4/packages/imsld/sql/postgresql/imsld-create.sql 4 Oct 2005 13:45:40 -0000 1.6 @@ -44,6 +44,10 @@ on delete cascade constraint imsld_id_pk primary key, + organization_id integer + constraint imsld_org_id_fk + references cr_items --imsld_cp_organizations + not null, identifier varchar(100) not null, version varchar(10), @@ -62,6 +66,7 @@ references cr_items --imsld_prerequisites ); +create index imsld_imsld_orgid_idx on imsld_imslds(organization_id); create index imsld_imsld_loid_idx on imsld_imslds(learning_objective_id); create index imsld_imsld_pid_idx on imsld_imslds(prerequisite_id); @@ -208,7 +213,7 @@ This attribute is used when there are several sub roles (e.g. chair, secretary, member). Persons can be matched exclusively to the sub roles, meaning that a person, who has the role of chair, may not be bound to one of the other roles at the same time. When it is not exclusive, persons may be bound to more than one sub role (this is the default situation). True means exclusively-in-roles and false means not-exlusively.'; -create table imsld_activity_desc ( +create table imsld_activity_descs ( description_id integer constraint imsld_act_desc_fk references cr_revisions @@ -218,7 +223,7 @@ pretty_title varchar(200) ); -comment on table imsld_activity_desc is ' +comment on table imsld_activity_descs is ' This table holds the descrition of a learning activity. Technically it is just a mapping table between items and the learning activity, but this table was created to provide simplicity and clarification in the data model'; 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.4 -r1.5 --- openacs-4/packages/imsld/sql/postgresql/imsld-drop.sql 27 Sep 2005 11:05:08 -0000 1.4 +++ openacs-4/packages/imsld/sql/postgresql/imsld-drop.sql 4 Oct 2005 13:45:40 -0000 1.5 @@ -19,7 +19,7 @@ drop table imsld_roles cascade; -drop table imsld_activity_desc; +drop table imsld_activity_descs; drop table imsld_learning_activities cascade; Index: openacs-4/packages/imsld/sql/postgresql/imsld-status-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/Attic/imsld-status-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/imsld/sql/postgresql/imsld-status-create.sql 27 Sep 2005 16:12:15 -0000 1.2 +++ openacs-4/packages/imsld/sql/postgresql/imsld-status-create.sql 4 Oct 2005 13:45:40 -0000 1.3 @@ -7,26 +7,38 @@ -- @creation-date sept-2005 -- -create table imsld_status_learner ( +create table imsld_status_user ( + imsld_id integer + constraint imsld_stat_imsldid_fk + references imsld_imslds + not null, role_part_id integer constraint imsld_stat_rp_fk references imsld_role_parts - not null, + not null, + completed_id integer + constraint imsld_stat_aid_fk + references cr_revisions -- reference to an learning_activity OR support_activity OR a + not null, -- ctivity_structure OR environment user_id integer constraint imsld_stat_user_fk references users not null, + type varchar(20) + check (type in ('learning','support','structure')), finished_date timestamptz default current_timestamp not null ); -create index imsld_stat_rp_idx on imsld_status_learner(role_part_id); -create index imsld_stat_user_idx on imsld_status_learner(user_id); +create index imsld_stat_imsld_idx on imsld_status_user(imsld_id); +create index imsld_stat_rp_idx on imsld_status_user(role_part_id); +create index imsld_stat_comp_idx on imsld_status_user(completed_id); +create index imsld_stat_user_idx on imsld_status_user(user_id); -comment on table imsld_status_learner is ' -This table holds the status of each learner in the unit of learning. -Each entry in this table says that the learner referenced by user_id has already COMPLETED the role part referenced by role_part_id, so if we want to know what role part is the next one for any learner, we just have to see the las completed role part which is the one stored in this table.'; +comment on table imsld_status_user is ' +This table holds the status of each user in the unit of learning. +Each entry in this table says that the user referenced by user_id has already COMPLETED the role part referenced by role_part_id, so if we want to know what role part is the next one for any user, we have to see the las completed role part and find out which one is next.'; Index: openacs-4/packages/imsld/sql/postgresql/imsld-status-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/Attic/imsld-status-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/sql/postgresql/imsld-status-drop.sql 27 Sep 2005 11:05:08 -0000 1.1 +++ openacs-4/packages/imsld/sql/postgresql/imsld-status-drop.sql 4 Oct 2005 13:45:40 -0000 1.2 @@ -5,5 +5,5 @@ -- @creation-date sept-2005 -- -drop table imsld_status_learner; +drop table imsld_status_user; Index: openacs-4/packages/imsld/tcl/imsld-cr-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-cr-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/tcl/imsld-cr-procs.tcl 5 Aug 2005 15:25:33 -0000 1.1 +++ openacs-4/packages/imsld/tcl/imsld-cr-procs.tcl 4 Oct 2005 13:45:40 -0000 1.2 @@ -53,7 +53,6 @@ ad_proc -public imsld::cr::file_new { -href - -resource_id -path_to_file -file_name {-item_id ""} @@ -70,7 +69,6 @@ Creates a new file in the file storage. Returns the item_id for that file. @param href href of the file (the path to the item in the file system) - @param resource_id resource id to which the resource belongs to @param path_to_file path to file in the fs @param file_name file name @option item_id Item_id of the file. [db_nextval "acs_object_id_seq"] used by default. @@ -100,8 +98,7 @@ select 1 from imsld_cp_files icf, cr_items cri where cri.item_id = :item_id - and cri.live_revision = icf.imsld_file_id - and icf.resource_id = :resource_id}] + and cri.live_revision = icf.imsld_file_id}] if { !$file_exists_p } { set item_id [content::item::new -item_id $item_id \ @@ -124,8 +121,7 @@ -item_id $item_id \ -mime_type $mime_type \ -is_live "t" \ - -attributes [list [list resource_id $resource_id] \ - [list path_to_file $path_to_file] \ + -attributes [list [list path_to_file $path_to_file] \ [list file_name $file_name] \ [list href $href]]] 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.2 -r1.3 --- openacs-4/packages/imsld/tcl/imsld-fs-procs.tcl 19 Sep 2005 17:20:15 -0000 1.2 +++ openacs-4/packages/imsld/tcl/imsld-fs-procs.tcl 4 Oct 2005 13:45:40 -0000 1.3 @@ -13,7 +13,6 @@ ad_proc -public imsld::fs::file_new { {-href ""} - {-resource_id ""} -path_to_file {-file_name ""} -type:required @@ -27,14 +26,13 @@ -edit:boolean -complete_path } { - Creates a file (file or directory) in the fs. If the type is file, the file is created with its attributes that are: href, resource_id, file_name, path_to_file and parent_id. + Creates a file (file or directory) in the fs. If the type is file, the file is created with its attributes, which are: href, file_name, path_to_file and parent_id. All the parent dirs (lindex 0) of the corresponding file (path_to_file) that are found in the files_struct_list are created too (if they haven't been created yet). The file structure is the one created with the imsld::parse::get_files_structure proc. Returns the file_id of the created file. @option href File href - @option resource_id Resource identifier of which the file belongs to. @param path_to_file Path to file @option file_name File name @param type File or dir @@ -59,16 +57,17 @@ # 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 - ns_log notice "a buscar en $structx \n\n\n" 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 $contentsx [string tolower $complete_path]] >= 0 && [string eq [lindex $contentsx 1] $type] } { + 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] if { !$parent_id } { # the dir hasn't been created @@ -95,68 +94,71 @@ # create the file with the parent_id found switch $type { file { - # insert file into the CR - db_transaction { - if { [empty_string_p $file_name] } { - regexp {[^//\\]+$} $path_to_file file_name - set file_name [imsld::safe_url_name -name $file_name] - } - set mime_type [cr_filename_to_mime_type -create $file_name] - # database_p according to the file storage parameter - set fs_package_id [site_node_apm_integration::get_child_package_id \ - -package_id [dotlrn_community::get_package_id [dotlrn_community::get_community_id]] \ - -package_key "file-storage"] - set database_p [parameter::get -parameter "StoreFilesInDatabaseP" -package_id $fs_package_id] - if { !$database_p } { - set storage_type file - } else { - set storabe_tupe lob - } - set file_id [imsld::cr::file_new -file_name $file_name \ - -resource_id $resource_id \ - -path_to_file $path_to_file \ - -href $href \ - -parent_id $parent_id \ - -mime_type $mime_type \ - -storage_type $storage_type \ - -item_id $item_id \ - -user_id $user_id \ - -creation_date $creation_date \ - -package_id $package_id \ - -creation_ip $creation_ip] - - set revision_id [content::item::get_live_revision -item_id $file_id] - set content_length [file size $complete_path] + if { !$found_id } { + # insert file into the CR + db_transaction { + if { [empty_string_p $file_name] } { + regexp {[^//\\]+$} $path_to_file file_name + set file_name [imsld::safe_url_name -name $file_name] + } + set mime_type [cr_filename_to_mime_type -create $file_name] + # database_p according to the file storage parameter + set fs_package_id [site_node_apm_integration::get_child_package_id \ + -package_id [dotlrn_community::get_package_id [dotlrn_community::get_community_id]] \ + -package_key "file-storage"] + set database_p [parameter::get -parameter "StoreFilesInDatabaseP" -package_id $fs_package_id] + if { !$database_p } { + set storage_type file + } else { + set storabe_tupe lob + } + set file_id [imsld::cr::file_new -file_name $file_name \ + -path_to_file $path_to_file \ + -href $href \ + -parent_id $parent_id \ + -mime_type $mime_type \ + -storage_type $storage_type \ + -item_id $item_id \ + -user_id $user_id \ + -creation_date $creation_date \ + -package_id $package_id \ + -creation_ip $creation_ip] + + set revision_id [content::item::get_live_revision -item_id $file_id] + set content_length [file size $complete_path] - if { !$database_p } { - # create the new item - set filename [cr_create_content_file $file_id $revision_id $complete_path] - db_dml set_file_content { - update cr_revisions - set content = :filename, - mime_type = :mime_type, - content_length = :content_length - where revision_id = :revision_id} - } else { - # create the new item - db_dml lob_content " + if { !$database_p } { + # create the new item + set filename [cr_create_content_file $file_id $revision_id $complete_path] + db_dml set_file_content { + update cr_revisions + set content = :filename, + mime_type = :mime_type, + content_length = :content_length + where revision_id = :revision_id} + } else { + # create the new item + db_dml lob_content " update cr_revisions set lob = [set __lob_id [db_string get_lob_id "select empty_lob()"]] where revision_id = :revision_id" -blob_files [list $complete_path] - - # Unfortunately, we can only calculate the file size after the lob is uploaded - db_dml lob_size { - update cr_revisions - set content_length = :content_length - where revision_id = :revision_id + + # Unfortunately, we can only calculate the file size after the lob is uploaded + db_dml lob_size { + update cr_revisions + set content_length = :content_length + where revision_id = :revision_id + } } } + # update file structure + set file_list [list $complete_path file $file_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] + } else { + set file_id $found_id } - # update file structure - set file_list [list $complete_path file $file_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] } dir { # create dir 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.7 -r1.8 --- openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 28 Sep 2005 09:54:47 -0000 1.7 +++ openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 4 Oct 2005 13:45:40 -0000 1.8 @@ -30,6 +30,7 @@ # imsld content::type::new -content_type imsld_imsld -supertype content_revision -pretty_name "<#_ IMS-LD #>" -pretty_plural "<#_ IMS-LDs #>" -table_name imsld_imslds -id_column imsld_id + content::type::attribute::new -content_type imsld_imsld -attribute_name organization_id -datatype number -pretty_name "<#_ Organization Identifier #>" -column_spec "integer" content::type::attribute::new -content_type imsld_imsld -attribute_name identifier -datatype string -pretty_name "<#_ Identifier #>" -column_spec "varchar(100)" content::type::attribute::new -content_type imsld_imsld -attribute_name version -datatype string -pretty_name "<#_ Version #>" -column_spec "varchar(10)" content::type::attribute::new -content_type imsld_imsld -attribute_name level -datatype string -pretty_name "<#_ Level #>" -column_spec "char(1)" @@ -75,7 +76,7 @@ content::type::attribute::new -content_type imsld_role -attribute_name href -datatype string -pretty_name "<#_ Href #>" -column_spec "varchar(2000)" # imsld activity description - content::type::new -content_type imsld_activity_desc -supertype content_revision -pretty_name "<#_ IMS-LD Activity Description #>" -pretty_plural "<#_ IMS-LD Activity Descriptions #>" -table_name imsld_activity_desc -id_column description_id + content::type::new -content_type imsld_activity_desc -supertype content_revision -pretty_name "<#_ IMS-LD Activity Description #>" -pretty_plural "<#_ IMS-LD Activity Descriptions #>" -table_name imsld_activity_descs -id_column description_id content::type::attribute::new -content_type imsld_activity_desc -attribute_name pretty_title -datatype string -pretty_name "<#_ Pretty Title #>" -column_spec "varchar(200)" @@ -235,7 +236,6 @@ # imsld cp files content::type::new -content_type imsld_cp_file -supertype content_revision -pretty_name "<#_ IMS-LD CP File #>" -pretty_plural "<#_ IMS-LD CP Filed #>" -table_name imsld_cp_files -id_column imsld_file_id - content::type::attribute::new -content_type imsld_cp_file -attribute_name resource_id -datatype number -pretty_name "<#_ Resource Identifier #>" -column_spec "integer" content::type::attribute::new -content_type imsld_cp_file -attribute_name path_to_file -datatype string -pretty_name "<#_ Path to File #>" -column_spec "varchar(2000)" content::type::attribute::new -content_type imsld_cp_file -attribute_name file_name -datatype string -pretty_name "<#_ File name #>" -column_spec "varchar(2000)" content::type::attribute::new -content_type imsld_cp_file -attribute_name href -datatype string -pretty_name "<#_ Href #>" -column_spec "varchar(2000)" @@ -247,13 +247,13 @@ Create default rels between imsld items } { - # dotLRN Community - IMS LD Manifests + # Learing Objetcives - IMS-LD Items rel_types::new imsld_lo_item_rel "Learing Objective - Imsld Item rel" "Learing Objective - Imsld Item rels" \ content_item 0 {} \ content_item 0 {} - # Learing Objetcives - IMS-LD Items - rel_types::new imsld_lo_item_rel "Learing Objective - Imsld Item rel" "Learing Objective - Imsld Item rels" \ + # Resource - Files + rel_types::new imsld_res_files_rel "Resource - Files rel" "Resource - Files rels" \ content_item 0 {} \ content_item 0 {} @@ -369,6 +369,7 @@ Delete default rels between imsld items } { imsld::rel_type_delete -rel_type imsld_lo_item_rel + imsld::rel_type_delete -rel_type imsld_res_files_rel imsld::rel_type_delete -rel_type imsld_preq_item_rel imsld::rel_type_delete -rel_type imsld_item_res_rel imsld::rel_type_delete -rel_type imsld_role_item_rel @@ -408,6 +409,7 @@ content::type::attribute::delete -content_type imsld_learning_object -attribute_name parameters # imsld + content::type::attribute::delete -content_type imsld_imsld -attribute_name organization_id content::type::attribute::delete -content_type imsld_imsld -attribute_name identifier content::type::attribute::delete -content_type imsld_imsld -attribute_name version content::type::attribute::delete -content_type imsld_imsld -attribute_name level 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.8 -r1.9 --- openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 28 Sep 2005 09:54:47 -0000 1.8 +++ openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 4 Oct 2005 13:45:40 -0000 1.9 @@ -524,14 +524,15 @@ set found_p 1 } set filex_id [imsld::fs::file_new -href $filex_href \ - -resource_id $resource_id \ -path_to_file $filex_href \ -type file \ -complete_path "${tmp_dir}/${filex_href}"] if { !$filex_id } { # an error ocurred when creating the file return [list 0 "<#_ The file $filex_href % was not created, it wasn't found in the manifest #>"] } + # map resource with file + relation_add imsld_res_files_rel $resource_id $filex_id } if { ![empty_string_p $resource_href] && !$found_p } { @@ -2513,7 +2514,7 @@ -parent_id $cr_folder_id] # map manifest with the community - relation_add $community_id $manifest_id + relation_add imsld_community_manifest_rel $community_id $manifest_id # organizaiton set organizations [$manifest child all imscp:organizations] @@ -2580,7 +2581,8 @@ [list version $imsld_version] \ [list sequence_p $imsld_sequence_p] \ [list learning_objectives $learning_objective_id] \ - [list prerequisite_id $prerequisite_id]] \ + [list prerequisite_id $prerequisite_id] \ + [list organization_id $organization_id]] \ -content_type imsld_imsld \ -title $imsld_title \ -parent_id $cr_folder_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.3 -r1.4 --- openacs-4/packages/imsld/tcl/imsld-procs.tcl 19 Sep 2005 17:20:15 -0000 1.3 +++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 4 Oct 2005 13:45:40 -0000 1.4 @@ -130,3 +130,309 @@ return $item_id } +ad_proc -public imsld::finish_component_element { +} { +} { + # get the url for parse it and get the info + set url [ns_conn url] + regexp {finish-component-element-([0-9]+)-([0-9]+)-([0-9]+)-([a-z]+).imsld$} $url match imsld_id role_part_id element_id type + regsub {finish-component-element.*} $url "" return_url + set user_id [ad_conn user_id] + # now that we have the necessary info, mark the finished element completed and return + db_dml insert_entry { + insert into imsld_status_user + values ( + :imsld_id, + :role_part_id, + :element_id, + :user_id, + :type, + now() + ) + } + + ad_returnredirect "[ad_url]${return_url}" +} + +ad_proc -public imsld::next_activity { + -imsld_item_id:required + {-user_id ""} + {-community_id ""} + -return_url +} { + @param imsld_item_id + @option user_id default [ad_conn user_id] + @option community_id + @param return_url url to return in the action links + + @return The list (activity_name, list of associated urls) of the next activity for the user in the IMS-LD. +} { + set community_id 2148 + set community_id [expr { [empty_string_p $community_id] ? "[dotlrn_community::get_community_id]" : $community_id }] + # Gets file-storage root folder_id + set fs_package_id [site_node_apm_integration::get_child_package_id \ + -package_id [dotlrn_community::get_package_id $community_id] \ + -package_key "file-storage"] + set root_folder_id [fs::get_root_folder -package_id $fs_package_id] + db_1row get_ismld_id { + select imsld_id + from imsld_imsldsi + where item_id = :imsld_item_id + and content_revision__is_live(imsld_id) = 't' + } + set completed_activities "" + set user_id [expr { [empty_string_p $user_id] ? [ad_conn user_id] : $user_id }] + if { ![db_string get_last_entry { + select count(*) + from imsld_status_user + where user_id = :user_id + and imsld_id = :imsld_id + }] } { + # special case: the user has no entry, the ims-ld hasn't started yet for that user + db_1row get_first_role_part { + select irp.role_part_id + from cr_items cr0, cr_items cr1, cr_items cr2, imsld_methods im, imsld_plays ip, imsld_acts ia, imsld_role_parts irp + where im.imsld_id = :imsld_item_id + and ip.method_id = cr0.item_id + and cr0.live_revision = im.method_id + and ia.play_id = cr1.item_id + and cr1.live_revision = ip.play_id + and irp.act_id = cr2.item_id + and cr2.live_revision = ia.act_id + and content_revision__is_live(irp.role_part_id) = 't' + and ip.sort_order = (select min(ip2.sort_order) from imsld_plays ip2 where ip2.method_id = cr0.item_id) + and ia.sort_order = (select min(ia2.sort_order) from imsld_acts ia2 where ia2.play_id = cr1.item_id) + and irp.sort_order = (select min(irp2.sort_order) from imsld_role_parts irp2 where irp2.act_id = cr2.item_id) + } + } else { + # get the completed activities in order to display them + # save the last one because we will use it latter + set completed_activities "<#_ " + # !!! + # the last completed is now stored in completed_id, let's find out the next role_part_id the user has to work on. + # Procedure (knowing that the info of the last role_part are stored in the last iteration vars): + # 1. get the next role_part from imsld_role_parts according to sort_number, first + # search in the current act_id, then in the current play_id, then in the next play_id and so on... + # 1.1 if there are no more role_parts then this is the last one + # 1.2 if we find a "next role_part", it will be treated latter, we just have to set the next role_part_id var + + # search in the current act_id + if { ![db_0or1row search_current_act { + select role_part_id + from imsld_role_parts + where sort_order = :sort_order + 1 + and act_id = :act_id + }] } { + # get current act_id's sort_order and search in the next act in the current play_id + db_1row get_current_play_id { + select ip.item_id as play_item_id, + ip.play_id, + ia.sort_order as act_sort_order + from imsld_playsi ip, imsld_acts ia, cr_items cr + where ip.item_id = ia.play_id + and ia.act_id = cr.live_revision + and cr.item_id = :act_id + } + if { ![db_0or1row search_current_play { + select rp.role_part_id + from imsld_role_parts rp, imsld_actsi ia + where ia.play_id = :play_item_id + and ia.sort_order = :act_sort_order + 1 + and rp.act_id = ia.item_id + and content_revision__is_live(rp.role_part_id) = 't' + and content_revision__is_live(ia.act_id) = 't' + and rp.sort_order = (select min(irp2.sort_order) from imsld_role_parts irp2 where irp2.act_id = rp.act_id) + }] } { + # get the current play_id's sort_order and sarch in the next play in the current method_id + db_1row get_current_method { + select im.item_id as method_item_id, + ip.sort_order as play_sort_order + from imsld_methodsi im, imsld_plays ip + where im.item_id = ip.method_id + and ip.play_id = :play_id + } + if { ![db_0or1row search_current_method { + select rp.role_part_id + from imsld_role_parts rp, imsld_actsi ia, imsld_playsi ip + where ip.method_id = :method_item_id + and ia.play_id = ip.item_id + and rp.act_id = ia.item_id + and ip.sort_order = :play_sort_order + 1 + and content_revision__is_live(rp.role_part_id) = 't' + and content_revision__is_live(ia.act_id) = 't' + and content_revision__is_live(ip.play_id) = 't' + and ia.sort_order = (select min(ia2.sort_order) from imsld_acts ia2 where ia2.play_id = ip.item_id) + and rp.sort_order = (select min(irp2.sort_order) from imsld_role_parts irp2 where irp2.act_id = ia.item_id) + }] } { + # there is no more to search, we reached the end of the unit of learning + return [list "finished!" {} "$completed_activities"] + } + } + } + } + + # !!! + # we assume thet the role_part_id can't have references to more than one activity + # (learning_activity, support_activity, activity_structure) + # 1. if it is a learning or support activity, no problem, find the associated files and return the lists + # 2. if it is an activity structure we have verify which activities are already completed and return the next + # activity in the activity structure, handling the case when the next activity is also an activity structure + + if { [db_0or1row learning_activity { + select la.activity_id, + la.item_id as activity_item_id, + la.title, + la.identifier, + la.user_choice_p + from imsld_learning_activitiesi la, imsld_role_parts irp, + cr_items cr + where irp.role_part_id = :role_part_id + and irp.learning_activity_id = cr.item_id + and cr.live_revision = la.activity_id + }] } { + # learning activity + # !!! HERE IS WHERE WE DECIDE IF WE CALL A DOTLRN SERVICE TO SERVE THE ACTIVITY, DEPENDING ON THE IDENTIFIER ??? + # BY DEFAULT GET THE RESOURCE AND DISPLAY IT FROM THE FILE STORAGE + set activity_name [expr { [empty_string_p $title] ? $identifier : $title }] + set activity_urls "<#_ " + } elseif { [db_0or1row support_activity { + select sa.activity_id, + sa.item_id as activity_item_id, + sa.title, + sa.identifier, + sa.user_choice_p + from imsld_support_activitiesi sa, imsld_role_parts irp, + cr_items cr + where irp.role_part_id = :role_part_id + and irp.learning_activity_id = cr.item_id + and cr.live_revision = sa.activity_id + }] } { + # support activity + # !!! HERE IS WHERE WE DECIDE IF WE CALL A DOTLRN SERVICE TO SERVE THE ACTIVITY, DEPENDING ON THE IDENTIFIER ??? + # BY DEFAULT GET THE RESOURCE AND DISPLAY IT FROM THE FILE STORAGE + set activity_name [expr { [empty_string_p $title] ? $identifier : $title }] + set activity_urls "<#_ " + } elseif { 1==3 } { + # activity structure. we have to look for the first learning or support activity + set activity_name "suport" + set activity_urls "urls!" + + } else { + set activity_name "... environment?" + set activity_urls "?????" + } + + return [list "$activity_name" "$activity_urls" "$completed_activities"] +} + +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/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/index.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/www/index.adp 28 Sep 2005 09:54:48 -0000 1.4 +++ openacs-4/packages/imsld/www/index.adp 4 Oct 2005 13:45:40 -0000 1.5 @@ -2,4 +2,10 @@ @page_title;noquote@ @context;noquote@ -index +
+ +
  • @imslds_in_class.imsld_title@
    + +

    + + Index: openacs-4/packages/imsld/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/index.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/www/index.tcl 28 Sep 2005 09:54:48 -0000 1.4 +++ openacs-4/packages/imsld/www/index.tcl 4 Oct 2005 13:45:40 -0000 1.5 @@ -3,14 +3,30 @@ set page_title index set context {} +set community_id 2148 -db_foreach imsld_in_class { - select all imslds in the class +db_multirow imslds_in_class get_manifests { + select cr3.item_id as imsld_id, + coalesce(imsld.title, imsld.identifier) as imsld_title + from acs_rels ar, cr_items cr1, cr_items cr2, cr_items cr3, imsld_cp_manifests icm, imsld_cp_organizations ico, imsld_imsldsi imsld + where ar.object_id_one = :community_id + and ar.rel_type = 'imsld_community_manifest_rel' + and ar.object_id_two = cr1.item_id + and cr1.live_revision = icm.manifest_id + and ico.manifest_id = cr1.item_id + and imsld.organization_id = cr2.item_id + and cr2.live_revision = ico.organization_id + and cr3.live_revision = imsld.imsld_id } { -# set next_activity [imsld::get_next_activity] + ns_log notice "vamos!!!!! \n" +} + +# set next_activity get_next_activity # display ismld_name # display copmleted activities -# display next activity with "finished" link and with link to the activity: if it is an activity structure? -} +# display next activity with finished link and with link to the activity: if it is an activity structure? +# the link finished will just add an entry to the status table +# environments? +# si es la primera vez, redirigir a un javascript q marque la entrada para contar el tiempo en time_to_complete +# manejar completadas, faltante y nombre con listas y mejorar despliegue! - Index: openacs-4/packages/imsld/www/test.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/Attic/test.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/www/test.adp 28 Sep 2005 09:54:48 -0000 1.1 +++ openacs-4/packages/imsld/www/test.adp 4 Oct 2005 13:45:40 -0000 1.2 @@ -3,4 +3,4 @@ @context;noquote@ index -@mensaje@ ;;;; @lista@ --- \ No newline at end of file +@mensaje@ ;;;; @ultimo@ \ No newline at end of file Index: openacs-4/packages/imsld/www/test.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/Attic/test.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/www/test.tcl 28 Sep 2005 09:54:48 -0000 1.1 +++ openacs-4/packages/imsld/www/test.tcl 4 Oct 2005 13:45:40 -0000 1.2 @@ -4,16 +4,33 @@ set page_title index set context {} -db_foreach imsld_in_class { - select all imslds in the class -} { -# set next_activity [imsld::get_next_activity] -# display ismld_name -# display copmleted activities -# display next activity with "finished" link and with link to the activity: if it is an activity structure? -} +db_foreach objeto { + select object_id, last_modified + from acs_objects + order by last_modified asc +} {} +set ultimo "$object_id, $last_modified" +if {2==2} { + ############## BEGIN + # THIS CALLS MUST BE DONE IN DOTLRN APLET ADD APPLET TO COMMUNITY + set community_id 2148 + + # create relationship: dotLRN Community - IMS LD Manifests + rel_types::new imsld_community_manifest_rel "dotLRN Community - IMS LD Manifests rel" "dotLRN Community - IMS LD Manifests rels" \ + [acs_object::get_element -object_id $community_id -element object_type] 0 {} \ + content_item 0 {} + + ############## END +} else { + ############## BEGIN + # THIS CALLS MUST BE DONE IN DOTLRN APLET REMOVE APPLET TO COMMUNITY + imsld::rel_type_delete -rel_type imsld_community_manifest_rel + + ############## END +} + # ad_proc beta {} {} { # global sms # set sms "JA! vemonos los pies : " @@ -35,7 +52,7 @@ # global sms # append sms sipuesdostres -# set variabfle $sms +# set variable $sms # set stypmy $lista # lappend lista [list z z j] Index: openacs-4/packages/imsld/www/admin/imsld-new-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/Attic/imsld-new-3.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/imsld/www/admin/imsld-new-3.tcl 27 Sep 2005 11:05:11 -0000 1.5 +++ openacs-4/packages/imsld/www/admin/imsld-new-3.tcl 4 Oct 2005 13:45:41 -0000 1.6 @@ -34,7 +34,7 @@ set manifest_list [imsld::parse::parse_and_create_imsld_manifest -xmlfile $tmp_dir/imsmanifest.xml \ -manifest_id $manifest_id \ -tmp_dir $tmp_dir \ - -community_id 2142] + -community_id 2148] set manifest_id [lindex $manifest_list 0]