Index: openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml,v
diff -u -N -r1.20 -r1.21
--- openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml 16 May 2006 09:24:34 -0000 1.20
+++ openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml 29 May 2006 15:10:52 -0000 1.21
@@ -276,7 +276,7 @@
Role Identifier
Role Type
Run (IMS-LD) Name
- Runs
+ Runs (IMS-LD instances)
Self
send-mail service
Sendmail Identifier
@@ -286,6 +286,7 @@
Sort
Sort Order
Staff Roles
+ Status
Structure Type
Support Activities
Then Identifier
Index: openacs-4/packages/imsld/lib/imsld-chunk.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/imsld-chunk.tcl,v
diff -u -N -r1.8 -r1.9
--- openacs-4/packages/imsld/lib/imsld-chunk.tcl 16 May 2006 09:24:35 -0000 1.8
+++ openacs-4/packages/imsld/lib/imsld-chunk.tcl 29 May 2006 15:10:52 -0000 1.9
@@ -4,6 +4,7 @@
-package_id [dotlrn_community::get_package_id $community_id] \
-package_key "[imsld::package_key]"]
set imsld_url "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]"
+set user_id [ad_conn user_id]
template::list::create \
-name imsld_runs \
@@ -33,22 +34,12 @@
set cr_root_folder_id [imsld::cr::get_root_folder -community_id $community_id]
-db_multirow imsld_runs get_manifests "
- select run.run_id,
- coalesce(imsld.title, imsld.identifier) as imsld_title,
- to_char(ao.creation_date,'MM/DD/YYYY HH24:MI') as creation_date
- from cr_items cr1, cr_items cr2, cr_items cr3, cr_items cr4, acs_objects ao,
- imsld_runs run, imsld_cp_manifests icm, imsld_cp_organizations ico, imsld_imsldsi imsld
- where run.imsld_id = imsld.imsld_id
- and ao.object_id = run.run_id
- and cr1.live_revision = icm.manifest_id
- and cr1.parent_id = cr4.item_id
- and cr4.parent_id = :cr_root_folder_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
- and run.status = 'active'
- $orderby
- " {}
+template::multirow create imsld_runs run_id imsld_title creation_date
+db_foreach active_runs { *SQL* } {
+ if { [llength [imsld::roles::get_user_roles -user_id $user_id -run_id $run_id]] } {
+ template::multirow append imsld_runs $run_id $imsld_title $creation_date
+ }
+}
+
+
Index: openacs-4/packages/imsld/sql/postgresql/imsld-level-a-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-level-a-create.sql,v
diff -u -N -r1.3 -r1.4
--- openacs-4/packages/imsld/sql/postgresql/imsld-level-a-create.sql 22 Mar 2006 15:36:59 -0000 1.3
+++ openacs-4/packages/imsld/sql/postgresql/imsld-level-a-create.sql 29 May 2006 15:10:52 -0000 1.4
@@ -722,3 +722,14 @@
comment on table imsld_as_as_rels is '
This table stores the information of the relationship between the activity structures (between them).';
+create table imsld_res_files_rels (
+ rel_id integer
+ constraint imsld_res_files_rels_fk
+ references acs_rels
+ constraint imsld_res_files_rels_pk
+ primary key
+);
+
+comment on table imsld_res_files_rels is '
+This table stores the relationships between resources and files.';
+
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 -N -r1.1 -r1.2
--- openacs-4/packages/imsld/sql/postgresql/imsld-level-a-drop.sql 30 Jan 2006 19:31:05 -0000 1.1
+++ openacs-4/packages/imsld/sql/postgresql/imsld-level-a-drop.sql 29 May 2006 15:10:52 -0000 1.2
@@ -51,3 +51,4 @@
drop table imsld_on_completion cascade;
+drop table imsld_res_files_rel cascade;
\ No newline at end of file
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 -N -r1.24 -r1.25
--- openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 19 May 2006 17:26:02 -0000 1.24
+++ openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 29 May 2006 15:10:52 -0000 1.25
@@ -395,9 +395,15 @@
content_item 0 {}
# Resource - Files
- rel_types::new imsld_res_files_rel "Resource - Files rel" "Resource - Files rels" \
+ rel_types::new -table_name imsld_res_files_rels \
+ -create_table_p 0 \
+ imsld_res_files_rel \
+ "Resource - Files rel" "Resource - Files rels" \
content_item 0 {} \
content_item 0 {}
+ attribute::add -min_n_values 0 -max_n_values 0 imsld_res_files_rel boolean "displayable_p" "Displayable?"
+ # FIX ME (there is no way to add attributes to the rels without creating the whole plsql code)
+ package_recreate_hierarchy imsld_res_files_rel
# Prerequisites - IMS-LD Items
rel_types::new imsld_preq_item_rel "Prerequisite - Imsld Item rel" "Prerequisite - Imsld Item rels" \
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 -N -r1.1 -r1.2
--- openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl 16 May 2006 09:24:35 -0000 1.1
+++ openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl 29 May 2006 15:10:52 -0000 1.2
@@ -23,8 +23,8 @@
Instantiates an imsld, i.e. creates the run.
If community_id is given, the run is created for that community (the users associated to the run are the users of the community)
} {
- # 1. create the run
- set run_id [package_exec_plsql -var_list [list [list run_id ""] [list imsld_id $imsld_id] [list status "active"]] imsld_run new]
+ # 1. create the run (status = 'waiting')
+ set run_id [package_exec_plsql -var_list [list [list run_id ""] [list imsld_id $imsld_id] [list status "waiting"]] imsld_run new]
# 2. create the run group
set group_run_id [package_instantiate_object -creation_user [ad_conn user_id] -creation_ip [ad_conn peeraddr] -package_name imsld_run_users_group -start_with "group" -var_list [list [list group_id ""] [list group_name "IMS-LD Run Group ($run_id)"] [list run_id $run_id]] imsld_run_users_group]
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 -N -r1.39 -r1.40
--- openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 19 May 2006 13:59:40 -0000 1.39
+++ openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 29 May 2006 15:10:52 -0000 1.40
@@ -594,41 +594,47 @@
if { ![llength $filex_list] } {
set filex_list [$resource_node child all file]
}
+ set found_id_in_list 0
foreach filex $filex_list {
set filex_href [imsld::parse::get_attribute -node $filex -attr_name href]
- if { ![empty_string_p $resource_href] && [string eq $resource_href $filex_href] } {
- # check if the referenced file in the resource exists
- # if we finish with the files and the referenced one doesn't exist we raise an error
- set found_p 1
- }
set filex_id [imsld::fs::file_new -href $filex_href \
-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 "[_ imsld.lt_The_file_filex_href_w]"]
+ }
+ if { ![empty_string_p $resource_href] && [string eq $resource_href $filex_href] } {
+ # check if the referenced file in the resource exists
+ # if we finish with the files and the referenced one doesn't exist we raise an error
+ set found_p 1
+ set extra_vars [util_list_to_ns_set [list displayable_p "t"]]
+ } elseif { [empty_string_p $resource_href] && [string eq $first_id_in_list 0] } {
+ set extra_vars [util_list_to_ns_set [list displayable_p "t"]]
} else {
- permission::set_not_inherit -object_id $filex_id
+ set extra_vars [util_list_to_ns_set [list displayable_p "f"]]
+ }
- set acs_object_id $filex_id
- set party_id [db_list get_allowed_parties {}]
- foreach parti $party_id {
- permission::revoke -party_id $parti -object_id $filex_id -privilege "read"
- }
-
+ permission::set_not_inherit -object_id $filex_id
+ set acs_object_id $filex_id
+ set party_id_list [db_list get_allowed_parties {}]
+ foreach party_id $party_id_list {
+ permission::revoke -party_id $party_id -object_id $filex_id -privilege "read"
}
+
# map resource with file
- relation_add imsld_res_files_rel $resource_id $filex_id
+ relation_add -extra_vars $extra_vars imsld_res_files_rel $resource_id $filex_id
}
if { ![empty_string_p $resource_href] && !$found_p } {
# the file is not in the manifest, assming it's an external (and existing) url
set link_id [content::extlink::new -url $resource_href \
-parent_id $parent_id]
# map resource with file
- relation_add imsld_res_files_rel $resource_id $link_id
+ set extra_vars [util_list_to_ns_set [list displayable_p "t"]]
+ relation_add -extra_vars $extra_vars imsld_res_files_rel $resource_id $link_id
}
set resource_dependencies [$resource_node child all imscp:dependency]
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 -N -r1.65 -r1.66
--- openacs-4/packages/imsld/tcl/imsld-procs.tcl 19 May 2006 17:26:02 -0000 1.65
+++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 29 May 2006 15:10:52 -0000 1.66
@@ -140,108 +140,53 @@
} {
Sweeps the methods, plays, acts and activities marking as finished the ones that already have been expired according with the value of time-limit.
} {
+ ns_log notice "imsld::sweep_expired_activities Sweeping methods.."
# 1. methods
- foreach referenced_method [db_list_of_lists possible_expired_method {
- select icm.manifest_id,
- ii.imsld_id,
- im.method_id,
- ca.time_in_seconds,
- icm.creation_date
- from imsld_cp_manifestsi icm, imsld_cp_organizationsi ico,
- imsld_imsldsi ii, imsld_methodsi im, imsld_complete_actsi ca
- where im.imsld_id = ii.item_id
- and ii.organization_id = ico.item_id
- and ico.manifest_id = icm.item_id
- and im.complete_act_id = ca.item_id
- and ca.time_in_seconds is not null
- and content_revision__is_live(im.method_id) = 't'
- }] {
+ foreach referenced_method [db_list_of_lists possible_expired_method { *SQL* }] {
set manifest_id [lindex $referenced_method 0]
set imsld_id [lindex $referenced_method 1]
set method_id [lindex $referenced_method 2]
- set time_in_seconds [lindex $referenced_method 3]
- set creation_date [lindex $referenced_method 4]
+ set run_id [lindex $referenced_method 3]
+ set time_in_seconds [lindex $referenced_method 4]
+ set creation_date [lindex $referenced_method 5]
if { [db_0or1row compre_times {
select 1
where (extract(epoch from now()) - extract(epoch from timestamp :creation_date) - :time_in_seconds > 0)
}] } {
# the method has been expired, let's mark it as finished
- set community_id [imsld::community_id_from_manifest_id -manifest_id $manifest_id]
- db_foreach user_in_class {
- select app.user_id
- from dotlrn_member_rels_approved app
- where app.community_id = :community_id
- and app.member_state = 'approved'
- } {
+ db_foreach user_in_run { *SQL* } {
imsld::mark_method_finished -imsld_id $imsld_id \
-run_id $run_id \
-method_id $method_id \
-user_id $user_id
}
}
}
+ ns_log notice "imsld::sweep_expired_activities Sweeping plays..."
# 2. plays
- foreach referenced_play [db_list_of_lists possible_expired_plays {
- select icm.manifest_id,
- ii.imsld_id,
- ip.play_id,
- ca.time_in_seconds,
- icm.creation_date
- from imsld_cp_manifestsi icm, imsld_cp_organizationsi ico,
- imsld_imsldsi ii, imsld_methodsi im, imsld_plays ip,
- imsld_complete_actsi ca
- where ip.method_id = im.item_id
- and im.imsld_id = ii.item_id
- and ii.organization_id = ico.item_id
- and ico.manifest_id = icm.item_id
- and ip.complete_act_id = ca.item_id
- and ca.time_in_seconds is not null
- and content_revision__is_live(ip.play_id) = 't'
- }] {
+ foreach referenced_play [db_list_of_lists possible_expired_plays { *SQL* }] {
set manifest_id [lindex $referenced_play 0]
set imsld_id [lindex $referenced_play 1]
set play_id [lindex $referenced_play 2]
set time_in_seconds [lindex $referenced_play 3]
set creation_date [lindex $referenced_play 4]
+ set run_id [lindex $referenced_play 5]
if { [db_0or1row compre_times {
select 1
where (extract(epoch from now()) - extract(epoch from timestamp :creation_date) - :time_in_seconds > 0)
}] } {
# the play has been expired, let's mark it as finished
- set community_id [imsld::community_id_from_manifest_id -manifest_id $manifest_id]
- db_foreach user_in_class {
- select app.user_id
- from dotlrn_member_rels_approved app
- where app.community_id = :community_id
- and app.member_state = 'approved'
- } {
+ db_foreach user_in_run { *SQL* } {
imsld::mark_play_finished -imsld_id $imsld_id \
-run_id $run_id \
-play_id $play_id \
-user_id $user_id
}
}
}
+ ns_log notice "imsld::sweep_expired_activities Sweeping acts..."
# 3. acts
- foreach referenced_act [db_list_of_lists possible_expired_acts {
- select icm.manifest_id,
- ii.imsld_id,
- ip.play_id,
- ia.act_id,
- ca.time_in_seconds,
- icm.creation_date
- from imsld_cp_manifestsi icm, imsld_cp_organizationsi ico,
- imsld_imsldsi ii, imsld_methodsi im, imsld_playsi ip, imsld_acts ia,
- imsld_complete_actsi ca
- where ia.play_id = ip.item_id
- and ip.method_id = im.item_id
- and im.imsld_id = ii.item_id
- and ii.organization_id = ico.item_id
- and ico.manifest_id = icm.item_id
- and ia.complete_act_id = ca.item_id
- and ca.time_in_seconds is not null
- and content_revision__is_live(ia.act_id) = 't'
- }] {
+ foreach referenced_act [db_list_of_lists possible_expired_acts { *SQL* }] {
set manifest_id [lindex $referenced_act 0]
set imsld_id [lindex $referenced_act 1]
set play_id [lindex $referenced_act 2]
@@ -253,13 +198,7 @@
where (extract(epoch from now()) - extract(epoch from timestamp :creation_date) - :time_in_seconds > 0)
}] } {
# the act has been expired, let's mark it as finished
- set community_id [imsld::community_id_from_manifest_id -manifest_id $manifest_id]
- db_foreach user_in_class {
- select app.user_id
- from dotlrn_member_rels_approved app
- where app.community_id = :community_id
- and app.member_state = 'approved'
- } {
+ db_foreach user_in_run { *SQL* } {
imsld::mark_act_finished -imsld_id $imsld_id \
-run_id $run_id \
-play_id $play_id \
@@ -268,124 +207,82 @@
}
}
}
-
+ ns_log notice "imsld::sweep_expired_activities Sweeping support activities..."
# 4. support activities
- foreach referenced_sa [db_list_of_lists referenced_sas {
- select sa.item_id as sa_item_id,
- sa.activity_id,
- ca.time_in_seconds
- from imsld_support_activitiesi sa,
- imsld_complete_actsi ca
- where sa.complete_act_id = ca.item_id
- and content_revision__is_live(ca.complete_act_id) = 't'
- and ca.time_in_seconds is not null
- }] {
+ foreach referenced_sa [db_list_of_lists referenced_sas { *SQL* }] {
set sa_item_id [lindex $referenced_sa 0]
set activity_id [lindex $referenced_sa 1]
set time_in_seconds [lindex $referenced_sa 2]
set role_part_id_list [imsld::get_role_part_from_activity -activity_type support -leaf_id $sa_item_id]
set community_id [imsld::community_id_from_manifest_id -manifest_id $manifest_id]
foreach role_part_id $role_part_id_list {
- db_1row get_sa_activity_info {
- select icm.manifest_id,
- ii.imsld_id,
- ip.play_id,
- ia.act_id,
- icm.creation_date
- from imsld_cp_manifestsi icm, imsld_cp_organizationsi ico,
- imsld_imsldsi ii, imsld_methodsi im, imsld_playsi ip,
- imsld_actsi ia, imsld_role_partsi irp
- where irp.role_part_id = :role_part_id
- and irp.act_id = ia.item_id
- and ia.play_id = ip.item_id
- and ip.method_id = im.item_id
- and im.imsld_id = ii.item_id
- and ii.organization_id = ico.item_id
- and ico.manifest_id = icm.item_id
- and content_revision__is_live(icm.manifest_id) = 't'
- }
- if { [db_0or1row compre_times {
- select 1
- where (extract(epoch from now()) - extract(epoch from timestamp :creation_date) - :time_in_seconds > 0)
- }] } {
- # the act has been expired, let's mark it as finished
- db_foreach user_in_class {
- select app.user_id
- from dotlrn_member_rels_approved app
- where app.community_id = :community_id
- and app.member_state = 'approved'
- } {
- imsld::finish_component_element -imsld_id $imsld_id \
- -run_id $run_id \
- -play_id $play_id \
- -act_id $act_id \
- -role_part_id $role_part_id \
- -element_id $activity_id \
- -type support \
- -user_id $user_id \
- -code_call
+ foreach referencer_list [db_list_of_lists sa_referencer { *SQL* }] {
+ set manifest_id [lindex $referencer_list 0]
+ set role_part_id [lindex $referencer_list 1]
+ set imsld_id [lindex $referencer_list 2]
+ set play_id [lindex $referencer_list 3]
+ set act_id [lindex $referencer_list 4]
+ set creation_date [lindex $referencer_list 5]
+ set run_id [lindex $referencer_list 6]
+
+ if { [db_0or1row compre_times {
+ select 1
+ where (extract(epoch from now()) - extract(epoch from timestamp :creation_date) - :time_in_seconds > 0)
+ }] } {
+ # the act has been expired, let's mark it as finished
+ db_foreach user_in_run { *SQL* } {
+ imsld::finish_component_element -imsld_id $imsld_id \
+ -run_id $run_id \
+ -play_id $play_id \
+ -act_id $act_id \
+ -role_part_id $role_part_id \
+ -element_id $activity_id \
+ -type support \
+ -user_id $user_id \
+ -code_call
+ }
}
}
}
}
-
+ ns_log notice "imsld::sweep_expired_activities Sweeping learning activities..."
# 5. learning activities
- foreach referenced_la [db_list_of_lists referenced_las {
- select la.item_id as la_item_id,
- la.activity_id,
- ca.time_in_seconds
- from imsld_learning_activitiesi la,
- imsld_complete_actsi ca
- where la.complete_act_id = ca.item_id
- and content_revision__is_live(ca.complete_act_id) = 't'
- and ca.time_in_seconds is not null
- }] {
+ foreach referenced_la [db_list_of_lists referenced_las { *SQL* }] {
set la_item_id [lindex $referenced_la 0]
set activity_id [lindex $referenced_la 1]
set time_in_seconds [lindex $referenced_la 2]
- foreach role_part_referencer [db_list_of_lists get_la_activity_references {
- select icm.manifest_id,
- irp.role_part_id,
- ii.imsld_id,
- ip.play_id,
- ia.act_id,
- icm.creation_date
- from imsld_cp_manifestsi icm, imsld_cp_organizationsi ico,
- imsld_imsldsi ii, imsld_methodsi im, imsld_playsi ip,
- imsld_actsi ia, imsld_role_partsi irp
- where irp.learning_activity_id = :la_item_id
- and irp.act_id = ia.item_id
- and ia.play_id = ip.item_id
- and ip.method_id = im.item_id
- and im.imsld_id = ii.item_id
- and ii.organization_id = ico.item_id
- and ico.manifest_id = icm.item_id
- and content_revision__is_live(icm.manifest_id) = 't'
- }] {
- if { [db_0or1row compre_times {
- select 1
- where (extract(epoch from now()) - extract(epoch from timestamp :creation_date) - :time_in_seconds > 0)
- }] } {
- # the act has been expired, let's mark it as finished
- set community_id [imsld::community_id_from_manifest_id -manifest_id $manifest_id]
- db_foreach user_in_class {
- select app.user_id
- from dotlrn_member_rels_approved app
- where app.community_id = :community_id
- and app.member_state = 'approved'
- } {
- imsld::finish_component_element -imsld_id $imsld_id \
- -run_id $run_id \
- -play_id $play_id \
- -act_id $act_id \
- -role_part_id $role_part_id \
- -element_id $activity_id \
- -type learning \
- -user_id $user_id \
- -code_call
+ set role_part_id_list [imsld::get_role_part_from_activity -activity_type learning -leaf_id $la_item_id]
+ foreach role_part_id $role_part_id_list {
+ foreach referencer_list [db_list_of_lists la_referencer { *SQL* }] {
+ set manifest_id [lindex $referencer_list 0]
+ set role_part_id [lindex $referencer_list 1]
+ set imsld_id [lindex $referencer_list 2]
+ set play_id [lindex $referencer_list 3]
+ set act_id [lindex $referencer_list 4]
+ set creation_date [lindex $referencer_list 5]
+ set run_id [lindex $referencer_list 6]
+
+ if { [db_0or1row compre_times {
+ select 1
+ where (extract(epoch from now()) - extract(epoch from timestamp :creation_date) - :time_in_seconds > 0)
+ }] } {
+ # the act has been expired, let's mark it as finished
+ # set community_id [imsld::community_id_from_manifest_id -manifest_id $manifest_id]
+ db_foreach user_in_run { *SQL* } {
+ imsld::finish_component_element -imsld_id $imsld_id \
+ -run_id $run_id \
+ -play_id $play_id \
+ -act_id $act_id \
+ -role_part_id $role_part_id \
+ -element_id $activity_id \
+ -type learning \
+ -user_id $user_id \
+ -code_call
+ }
}
}
}
+
}
}
@@ -439,12 +336,14 @@
-user_id $user_id \
-code_call
+ dom createDocument foo foo_doc
+ set foo_node [$foo_doc documentElement]
if { [string eq $$type "learning"] } {
- set resources_activities_list [imsld::process_learning_activity -activity_item_id $activity_item_id -resource_mode "t"]
+ set resources_activities_list [imsld::process_learning_activity_as_ul -run_id $run_id -activity_item_id $activity_item_id -resource_mode "t" -dom_node $foo_node -dom_doc $foo_doc]
} elseif { [string eq $$type "support"] } {
- set resources_activities_list [imsld::process_support_activity -activity_item_id $activity_item_id -resource_mode "t"]
+ set resources_activities_list [imsld::process_support_activity_as_ul -run_id $run_id -activity_item_id $activity_item_id -resource_mode "t" -dom_node $foo_node -dom_doc $foo_doc]
} else {
- set resources_activities_list [imsld::process_activity_structure -structure_item_id $activity_item_id -resource_mode "t"]
+ set resources_activities_list [imsld::process_activity_structure_as_ul -run_id $run_id -structure_item_id $activity_item_id -resource_mode "t" -dom_node $foo_node -dom_doc $foo_doc]
}
#grant permissions for newly showed resources
imsld::grant_permissions -resources_activities_list $resources_activities_list -user_id $user_id
@@ -651,7 +550,6 @@
set item_id [expr { [string eq "" $item_id] ? [db_nextval "acs_object_id_seq"] : $item_id }]
set item_name "${item_id}_content_type"
-# set title [expr { [string eq "" $title] ? $item_name : $title }]
if { !$edit_p } {
# create
@@ -671,14 +569,16 @@
-creation_user $user_id \
-creation_ip $creation_ip \
-is_live "t" \
- -attributes $attributes]
+ -attributes $attributes \
+ -package_id $package_id]
} else {
set revision_id [content::revision::new -item_id $item_id \
-title $title \
-content_type $content_type \
-creation_user $user_id \
-creation_ip $creation_ip \
- -is_live "t"]
+ -is_live "t" \
+ -package_id $package_id]
}
return $item_id
@@ -1301,45 +1201,15 @@
set services_list [list]
# get service info
- if { ![db_0or1row service_info {
- select serv.service_id,
- serv.identifier,
- serv.service_type,
- serv.title as service_title
- from imsld_servicesi serv
- where serv.item_id = :service_item_id
- and content_revision__is_live(serv.service_id) = 't'
- }] } {
+ if { ![db_0or1row service_info { *SQL* }] } {
# not visible, return
return
}
switch $service_type {
conference {
- db_1row get_conference_info {
- select conf.conference_id,
- conf.conference_type,
- conf.imsld_item_id as imsld_item_item_id,
- cr.live_revision as imsld_item_id,
- conf.title as conf_title
- from imsld_conference_servicesi conf, cr_items cr
- where conf.service_id = :service_item_id
- and cr.item_id = conf.imsld_item_id
- and content_revision__is_live(cr.live_revision) = 't'
- }
- db_foreach serv_associated_items {
- select cpr.resource_id,
- cpr.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resourcesi cpr, imsld_itemsi ii,
- acs_rels ar
- where ar.object_id_one = ii.item_id
- and ar.object_id_two = cpr.item_id
- and content_revision__is_live(cpr.resource_id) = 't'
- and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- or ii.imsld_item_id = :imsld_item_id)
- } {
+ db_1row get_conference_info { *SQL* }
+ db_foreach serv_associated_items { *SQL* } {
if {[string eq "t" $resource_mode]} {
lappend resource_item_list $resource_item_id
}
@@ -1363,16 +1233,9 @@
send-mail {
# FIX ME: when roles are supported, fix it so the mail is sent to the propper role
- set resource_item_list ""
- db_1row get_send_mail_info {
- select sm.title as send_mail_title
- from imsld_send_mail_servicesi sm
- where sm.service_id = :service_item_id
- and content_revision__is_live(sm.mail_id) = 't'
- }
+ set resource_item_list [list]
+ db_1row get_send_mail_info { *SQL* }
-
- db_1row get_sendmail_id {}
set send_mail_node_li [$dom_doc createElement li]
set a_node [$dom_doc createElement a]
@@ -1394,85 +1257,6 @@
}
}
-ad_proc -public imsld::process_service {
- -service_item_id:required
- {-resource_mode "f"}
-} {
- returns a list of the associated resources referenced from the given service.
-} {
- set services_list [list]
- # get service info
- db_1row service_info {
- select serv.service_id,
- serv.identifier,
- serv.class,
- serv.is_visible_p,
- serv.service_type
- from imsld_servicesi serv
- where serv.item_id = :service_item_id
- and content_revision__is_live(serv.service_id) = 't'
- }
-
- switch $service_type {
- conference {
- db_1row get_conference_info {
- select conf.conference_id,
- conf.conference_type,
- conf.imsld_item_id as imsld_item_item_id,
- cr.live_revision as imsld_item_id
- from imsld_conference_services conf, cr_items cr
- where conf.service_id = :service_item_id
- and cr.item_id = conf.imsld_item_id
- and content_revision__is_live(cr.live_revision) = 't'
- }
- db_foreach serv_associated_items {
- select cpr.resource_id,
- cpr.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resourcesi cpr, imsld_itemsi ii,
- acs_rels ar
- where ar.object_id_one = ii.item_id
- and ar.object_id_two = cpr.item_id
- and content_revision__is_live(cpr.resource_id) = 't'
- and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- or ii.imsld_item_id = :imsld_item_id)
- } {
- if {[string eq "t" $resource_mode]} {
- lappend resource_item_list $resource_item_id
- }
- append one_service_url "[imsld::process_resource -resource_item_id $resource_item_id]"
- if { [string eq "" $one_service_url] } {
- lappend services_list "[_ imsld.lt_li_desc_no_file_assoc]"
- } else {
- set services_list [expr { [llength $services_list] ? [concat [list $services_list] [list $one_service_url]] : $one_service_url }]
- }
- } if_no_rows {
- ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]"
- }
- }
-
- send-mail {
-
- db_1row get_sendmail_id {}
- set image_path [imsld::object_type_image_path -object_type $service_type]
- set services_list ""
- set resource_item_list $service_item_id
- }
-
- default {
- ad_return_error "[_ imsld.lt_Service_type_service_]" "[_ imsld.lt_Sorry_that_service_ty]"
- ad_script_abort
- }
- }
- if {[string eq "t" $resource_mode]} {
- return [list $services_list $resource_item_list]
- } else {
- return "$services_list"
- }
-
-}
-
ad_proc -public imsld::process_environment_as_ul {
-environment_item_id:required
-run_id:required
@@ -1489,13 +1273,7 @@
@return a html list (in a dom tree) of the associated resources, files and environments referenced from the given environment.
} {
# get environment info
- db_1row environment_info {
- select env.title as environment_title,
- env.environment_id
- from imsld_environmentsi env
- where env.item_id = :environment_item_id
- and content_revision__is_live(env.environment_id) = 't'
- }
+ db_1row environment_info { *SQL* }
set environment_node_li [$dom_doc createElement li]
$environment_node_li setAttribute class "liOpen"
@@ -1507,21 +1285,7 @@
$environment_node appendChild $text
set environment_learning_objects_list [list]
- foreach learning_objects_list [db_list_of_lists get_learning_object_info {
- select item_id as learning_object_item_id,
- learning_object_id,
- identifier,
- coalesce(title,identifier) as lo_title,
- class
- from imsld_learning_objectsi, imsld_attribute_instances attr
- where environment_id = :environment_item_id
- and content_revision__is_live(learning_object_id) = 't'
- and attr.owner_id = learning_object_id
- and attr.run_id = :run_id
- and attr.type = 'isvisible'
- and attr.is_visible_p = 't'
- order by creation_date
- }] {
+ foreach learning_objects_list [db_list_of_lists get_learning_object_info { *SQL* }] {
set learning_object_item_id [lindex $learning_objects_list 0]
set learning_object_id [lindex $learning_objects_list 1]
set identifier [lindex $learning_objects_list 2]
@@ -1531,46 +1295,22 @@
continue
}
# learning object item. get the files associated
- set linear_item_list [db_list_of_lists item_linear_list {
- select ii.imsld_item_id
- from imsld_items ii,
- cr_items cr,
- acs_rels ar
- where ar.object_id_one = :learning_object_item_id
- and ar.object_id_two = cr.item_id
- and cr.live_revision = ii.imsld_item_id
- }]
+ set linear_item_list [db_list_of_lists item_linear_list { *SQL* }]
foreach imsld_item_id $linear_item_list {
- foreach environments_list [db_list_of_lists env_nested_associated_items {
- select cpr.resource_id,
- cr2.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resources cpr, imsld_items ii, imsld_attribute_instances attr,
- acs_rels ar, cr_items cr1, cr_items cr2
- where ar.object_id_one = cr1.item_id
- and ar.object_id_two = cr2.item_id
- and cr1.live_revision = ii.imsld_item_id
- and cr2.live_revision = cpr.resource_id
- and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- or ii.imsld_item_id = :imsld_item_id)
- and attr.owner_id = ii.imsld_item_id
- and attr.run_id = :run_id
- and attr.type = 'isvisible'
- and attr.is_visible_p = 't'
- }] {
+ foreach environments_list [db_list_of_lists env_nested_associated_items { *SQL* }] {
set resource_id [lindex $environments_list 0]
set resource_item_id [lindex $environments_list 1]
set resource_type [lindex $environments_list 2]
if { [string eq "t" $resource_mode] } {
lappend resource_item_list $resource_item_id
}
+
set one_learning_object_list [imsld::process_resource_as_ul -resource_item_id $resource_item_id \
-run_id $run_id \
-dom_node $environment_node \
-dom_doc $dom_doc \
-li_mode]
-
+
# in order to behave like CopperCore, we decide to replace the images with the learning object title
set img_nodes [$environment_node selectNodes {.//img}]
foreach img_node $img_nodes {
@@ -1591,21 +1331,7 @@
# services
set environment_services_list [list]
- foreach services_list [db_list_of_lists get_service_info {
- select service_id,
- item_id as service_item_id,
- identifier,
- service_type,
- title as service_title,
- class
- from imsld_servicesi, imsld_attribute_instances attr
- where environment_id = :environment_item_id
- and content_revision__is_live(service_id) = 't'
- and attr.owner_id = service_id
- and attr.run_id = :run_id
- and attr.type = 'isvisible'
- and attr.is_visible_p = 't'
- }] {
+ foreach services_list [db_list_of_lists get_service_info { *SQL* }] {
set service_id [lindex $services_list 0]
set service_item_id [lindex $services_list 1]
set identifier [lindex $services_list 2]
@@ -1634,12 +1360,7 @@
set nested_environment_list [list]
# environments
- foreach nested_environment_item_id [db_list nested_environment {
- select ar.object_id_two as nested_environment_item_id
- from acs_rels ar
- where ar.object_id_one = :environment_item_id
- and ar.rel_type = 'imsld_env_env_rel'
- }] {
+ foreach nested_environment_item_id [db_list nested_environment { *SQL* }] {
set one_nested_environment_list [imsld::process_environment_as_ul -environment_item_id $nested_environment_item_id \
-run_id $run_id \
-resource_mode $resource_mode \
@@ -1660,98 +1381,6 @@
}
}
-ad_proc -public imsld::process_environment {
- -environment_item_id:required
- {-community_id ""}
- {-resource_mode "f"}
-} {
- returns a list of the associated resources, files and environments referenced from the given environment.
-} {
- set community_id [expr { [string eq "" $community_id] ? "[dotlrn_community::get_community_id]" : $community_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]
-
- # get environment info
- db_1row environment_info {
- select env.title as environment_title,
- env.environment_id
- from imsld_environmentsi env
- where env.item_id = :environment_item_id
- and content_revision__is_live(env.environment_id) = 't'
- }
-
- set environment_learning_objects_list [list]
- foreach learning_objects_list [db_list_of_lists get_learning_object_info {
- select item_id as learning_object_item_id,
- learning_object_id,
- identifier
- from imsld_learning_objectsi
- where environment_id = :environment_item_id
- and content_revision__is_live(learning_object_id) = 't'
- }] {
- set learning_object_item_id [lindex $learning_objects_list 0]
- set learning_object_id [lindex $learning_objects_list 1]
- set identifier [lindex $learning_objects_list 2]
- # learning object item. get the files associated
- set linear_item_list [db_list_of_lists item_linear_list { *SQL* }]
- foreach imsld_item_id $linear_item_list {
- foreach environments_list [db_list_of_lists env_nested_associated_items { *SQL* }] {
- set resource_id [lindex $environments_list 0]
- set resource_item_id [lindex $environments_list 1]
- set resource_type [lindex $environments_list 2]
- if { [string eq "t" $resource_mode] } {
- lappend resource_item_list $resource_item_id
- }
- set one_learning_object_list [imsld::process_resource -resource_item_id $resource_item_id]
- if { ![string eq "" $one_learning_object_list] } {
- if { [string eq "t" $resource_mode] } {
- set environment_learning_objects_list [concat $environment_learning_objects_list \
- [list $one_learning_object_list] \
- $resource_item_list ]
- } else {
- set environment_learning_objects_list [concat $environment_learning_objects_list \
- [list $one_learning_object_list]]
- }
- }
- }
- }
- }
- # services
- set environment_services_list [list]
- foreach services_list [db_list_of_lists get_service_info {
- select service_id,
- item_id as service_item_id,
- identifier,
- service_type
- from imsld_servicesi
- where environment_id = :environment_item_id
- and content_revision__is_live(service_id) = 't'
- }] {
- set service_id [lindex $services_list 0]
- set service_item_id [lindex $services_list 1]
- set identifier [lindex $services_list 2]
- set service_type [lindex $services_list 3]
- set environment_services_list [concat $environment_services_list \
- [imsld::process_service -service_item_id $service_item_id -resource_mode $resource_mode]]
- }
- set nested_environment_list [list]
- # environments
- foreach nested_environment_item_id [db_list nested_environment { *SQL* }] {
- set one_nested_environment_list [imsld::process_environment -environment_item_id $nested_environment_item_id]
- # the title is stored in [lindex $one_nested_environment_list 0], but is not returned for displaying porpouses
- set nested_environment_list [concat $nested_environment_list \
- [lindex $one_nested_environment_list 1] \
- [lindex $one_nested_environment_list 2] \
- [lindex $one_nested_environment_list 3]]
- regsub -all "{}" $nested_environment_list "" nested_environment_list
- }
- set return_list [list $environment_title $environment_learning_objects_list $environment_services_list $nested_environment_list]
- return $return_list
-}
-
ad_proc -public imsld::process_learning_objective_as_ul {
-run_id:required
{-imsld_item_id ""}
@@ -1771,61 +1400,23 @@
} {
set learning_objective_item_id ""
if { ![string eq "" $imsld_item_id] } {
- db_0or1row get_lo_id_from_iii {
- select learning_objective_id as learning_objective_item_id
- from imsld_imsldsi
- where item_id = :imsld_item_id
- and content_revision__is_live(imsld_id) = 't'
- }
+ db_0or1row lo_id_from_imsld_item_id { *SQL* }
} elseif { ![string eq "" $activity_item_id] } {
- db_0or1row get_lo_id_from_aii {
- select learning_objective_id as learning_objective_item_id
- from imsld_learning_activitiesi
- where item_id = :activity_item_id
- and content_revision__is_live(activity_id) = 't'
- }
+ db_0or1row lo_id_from_activity_item_id { *SQL* }
}
if { [string eq "" $learning_objective_item_id] } {
return -code error "IMSLD::imsld::process_learning_objective: Invalid call"
}
# get learning object info
- db_1row objective_info {
- select lo.pretty_title as objective_title,
- lo.learning_objective_id
- from imsld_learning_objectivesi lo
- where lo.item_id = :learning_objective_item_id
- and content_revision__is_live(lo.learning_objective_id) = 't'
- }
+ db_1row objective_info { *SQL* }
# get the items associated with the learning objective
- set linear_item_list [db_list item_linear_list {
- select ii.imsld_item_id
- from imsld_items ii,
- cr_items cr, acs_rels ar
- where ar.object_id_one = :learning_objective_item_id
- and ar.object_id_two = cr.item_id
- and cr.live_revision = ii.imsld_item_id
- }]
+ set resource_item_list [list]
+ set linear_item_list [db_list item_linear_list { *SQL* }]
foreach imsld_item_id $linear_item_list {
- db_foreach lo_nested_associated_items {
- select cpr.resource_id,
- cpr.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resourcesi cpr, imsld_itemsi ii, imsld_attribute_instances attr,
- acs_rels ar
- where ar.object_id_one = ii.item_id
- and ar.object_id_two = cpr.item_id
- and content_revision__is_live(cpr.resource_id) = 't'
- and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- or ii.imsld_item_id = :imsld_item_id)
- and attr.owner_id = ii.imsld_item_id
- and attr.run_id = :run_id
- and attr.type = 'isvisible'
- and attr.is_visible_p = 't'
- } {
+ db_foreach lo_nested_associated_items { *SQL* } {
if { [string eq "t" $resource_mode] } {
lappend resource_item_list $resource_item_id
}
@@ -1839,103 +1430,10 @@
}
}
if { [string eq "t" $resource_mode] } {
- return [list $objective_title $objective_items_list $resource_item_list]
+ return [list $resource_item_list]
}
}
-ad_proc -public imsld::process_learning_objective {
- {-imsld_item_id ""}
- {-activity_item_id ""}
- {-community_id ""}
- {-resource_mode "f"}
-} {
- returns a list with the objective title and the associated resources, files and environments referenced from the learning objective of the given activity or ims-ld
-} {
- set community_id [expr { [string eq "" $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]
-
- set learning_objective_item_id ""
- if { ![string eq "" $imsld_item_id] } {
- db_0or1row get_lo_id_from_iii {
- select learning_objective_id as learning_objective_item_id
- from imsld_imsldsi
- where item_id = :imsld_item_id
- and content_revision__is_live(imsld_id) = 't'
- }
- } elseif { ![string eq "" $activity_item_id] } {
- db_0or1row get_lo_id_from_aii {
- select learning_objective_id as learning_objective_item_id
- from imsld_learning_activitiesi
- where item_id = :activity_item_id
- and content_revision__is_live(activity_id) = 't'
- }
- } else {
- return -code error "IMSLD::imsld::process_learning_objective: Invalid call"
- }
-
- if { [string eq "" $learning_objective_item_id] } {
- return ""
- }
-
- # get learning object info
- db_1row objective_info {
- select coalesce(lo.pretty_title, '') as objective_title,
- lo.learning_objective_id
- from imsld_learning_objectivesi lo
- where lo.item_id = :learning_objective_item_id
- and content_revision__is_live(lo.learning_objective_id) = 't'
- }
- set objective_items_list [list]
-
- # get the items associated with the learning objective
- set linear_item_list [db_list item_linear_list {
- select ii.imsld_item_id
- from imsld_items ii,
- cr_items cr, acs_rels ar
- where ar.object_id_one = :learning_objective_item_id
- and ar.object_id_two = cr.item_id
- and cr.live_revision = ii.imsld_item_id
- }]
- foreach imsld_item_id $linear_item_list {
- db_foreach lo_nested_associated_items {
- select cpr.resource_id,
- cpr.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resourcesi cpr, imsld_itemsi ii,
- acs_rels ar
- where ar.object_id_one = ii.item_id
- and ar.object_id_two = cpr.item_id
- and content_revision__is_live(cpr.resource_id) = 't'
- and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- or ii.imsld_item_id = :imsld_item_id)
- } {
- if { [string eq "t" $resource_mode] } {
- lappend resource_item_list $resource_item_id
- }
- set one_objective_urls "[imsld::process_resource -resource_item_id $resource_item_id]"
- if { [string eq "" $one_objective_urls] } {
- ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]"
- } else {
- set objective_items_list [concat [list $objective_items_list] [list $one_objective_urls]]
- }
- } if_no_rows {
- ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]"
- }
- }
- if { [string eq "t" $resource_mode] } {
- return [list $objective_title $objective_items_list $resource_item_list]
- } else {
- return [list $objective_title $objective_items_list]
- }
-
-
-}
-
ad_proc -public imsld::process_prerequisite_as_ul {
-run_id:required
{-imsld_item_id ""}
@@ -1955,61 +1453,22 @@
} {
set prerequisite_item_id ""
if { ![string eq "" $imsld_item_id] } {
- db_0or1row get_lo_id_from_iii {
- select prerequisite_id as prerequisite_item_id
- from imsld_imsldsi
- where item_id = :imsld_item_id
- and content_revision__is_live(imsld_id) = 't'
- }
+ db_0or1row lo_id_from_imsld_item_id { *SQL* }
} elseif { ![string eq "" $activity_item_id] } {
- db_0or1row get_lo_id_from_aii {
- select prerequisite_id as prerequisite_item_id
- from imsld_learning_activitiesi
- where item_id = :activity_item_id
- and content_revision__is_live(activity_id) = 't'
- }
+ db_0or1row lo_id_from_activity_item_id { *SQL* }
}
if { [string eq "" $prerequisite_item_id] } {
return -code error "IMSLD::imsld::process_prerequisite: Invalid call"
}
# get prerequisite info
- db_1row prerequisite_info {
- select coalesce(pre.pretty_title, '') as prerequisite_title,
- pre.prerequisite_id
- from imsld_prerequisitesi pre
- where pre.item_id = :prerequisite_item_id
- and content_revision__is_live(pre.prerequisite_id) = 't'
- }
+ db_1row prerequisite_info { *SQL* }
# get the items associated with the learning objective
- set linear_item_list [db_list item_linear_list {
- select ii.imsld_item_id
- from imsld_items ii,
- cr_items cr, acs_rels ar
- where ar.object_id_one = :prerequisite_item_id
- and ar.object_id_two = cr.item_id
- and cr.live_revision = ii.imsld_item_id
- }]
+ set linear_item_list [db_list item_linear_list { *SQL* }]
foreach imsld_item_id $linear_item_list {
- db_foreach prereq_nested_associated_items {
- select cpr.resource_id,
- cpr.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resourcesi cpr, imsld_itemsi ii, imsld_attribute_instances attr,
- acs_rels ar
- where ar.object_id_one = ii.item_id
- and ar.object_id_two = cpr.item_id
- and content_revision__is_live(cpr.resource_id) = 't'
- and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- or ii.imsld_item_id = :imsld_item_id)
- and attr.owner_id = ii.imsld_item_id
- and attr.run_id = :run_id
- and attr.type = 'isvisible'
- and attr.is_visible_p = 't'
- } {
+ db_foreach prereq_nested_associated_items { *SQL* } {
if { [string eq "t" $resource_mode] } {
lappend resource_item_list $resource_item_id
}
@@ -2027,98 +1486,6 @@
}
}
-ad_proc -public imsld::process_prerequisite {
- {-imsld_item_id ""}
- {-activity_item_id ""}
- {-community_id ""}
- {-resource_mode "f"}
-} {
- returns a list of the associated resources, files and environments referenced from the prerequisite of the given ims-ld or activity
-} {
- set community_id [expr { [string eq "" $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]
-
- set prerequisite_item_id ""
- if { ![string eq "" $imsld_item_id] } {
- db_0or1row get_lo_id_from_iii {
- select prerequisite_id as prerequisite_item_id
- from imsld_imsldsi
- where item_id = :imsld_item_id
- and content_revision__is_live(imsld_id) = 't'
- }
- } elseif { ![string eq "" $activity_item_id] } {
- db_0or1row get_lo_id_from_aii {
- select prerequisite_id as prerequisite_item_id
- from imsld_learning_activitiesi
- where item_id = :activity_item_id
- and content_revision__is_live(activity_id) = 't'
- }
- } else {
- return -code error "IMSLD::imsld::process_prerequisite: Invalid call"
- }
-
- if { [string eq "" $prerequisite_item_id] } {
- return ""
- }
-
- # get prerequisite info
- db_1row prerequisite_info {
- select coalesce(pre.pretty_title, '') as prerequisite_title,
- pre.prerequisite_id
- from imsld_prerequisitesi pre
- where pre.item_id = :prerequisite_item_id
- and content_revision__is_live(pre.prerequisite_id) = 't'
- }
-
- set prerequisite_items_list [list]
-
- # get the items associated with the learning objective
- set linear_item_list [db_list item_linear_list {
- select ii.imsld_item_id
- from imsld_items ii,
- cr_items cr, acs_rels ar
- where ar.object_id_one = :prerequisite_item_id
- and ar.object_id_two = cr.item_id
- and cr.live_revision = ii.imsld_item_id
- }]
- foreach imsld_item_id $linear_item_list {
- db_foreach prereq_nested_associated_items {
- select cpr.resource_id,
- cpr.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resourcesi cpr, imsld_itemsi ii,
- acs_rels ar
- where ar.object_id_one = ii.item_id
- and ar.object_id_two = cpr.item_id
- and content_revision__is_live(cpr.resource_id) = 't'
- and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- or ii.imsld_item_id = :imsld_item_id)
- } {
- if { [string eq "t" $resource_mode] } {
- lappend resource_item_list $resource_item_id
- }
- set one_prerequisite_urls "[imsld::process_resource -resource_item_id $resource_item_id]"
- if { [string eq "" $one_prerequisite_urls] } {
- ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]"
- } else {
- set prerequisite_items_list [concat [list $prerequisite_items_list] [list $one_prerequisite_urls] ]
- }
- } if_no_rows {
- ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]"
- }
- }
- if { [string eq "t" $resource_mode] } {
- return [list $prerequisite_title $prerequisite_items_list $resource_item_list]
- } else {
- return [list $prerequisite_title $prerequisite_items_list]
- }
-}
-
ad_proc -public imsld::process_feedback_as_ul {
-run_id:required
{-on_completion_item_id ""}
@@ -2134,40 +1501,12 @@
} {
set feedback_item_id ""
# get on completion info
- db_1row feedback_info {
- select coalesce(oc.feedback_title, oc.title) as feedback_title
- from imsld_on_completioni oc
- where oc.item_id = :on_completion_item_id
- and content_revision__is_live(oc.on_completion_id) = 't'
- }
+ db_1row feedback_info { *SQL* }
# get the items associated with the feedback
- set linear_item_list [db_list item_linear_list {
- select ii.imsld_item_id
- from imsld_items ii,
- cr_items cr, acs_rels ar
- where ar.object_id_one = :on_completion_item_id
- and ar.object_id_two = cr.item_id
- and cr.live_revision = ii.imsld_item_id
- }]
+ set linear_item_list [db_list item_linear_list { *SQL* }]
foreach imsld_item_id $linear_item_list {
- db_foreach feedback_nested_associated_items {
- select cpr.resource_id,
- cpr.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resourcesi cpr, imsld_itemsi ii, imsld_attribute_instances attr,
- acs_rels ar
- where ar.object_id_one = ii.item_id
- and ar.object_id_two = cpr.item_id
- and content_revision__is_live(cpr.resource_id) = 't'
- and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- or ii.imsld_item_id = :imsld_item_id)
- and attr.owner_id = ii.imsld_item_id
- and attr.run_id = :run_id
- and attr.type = 'isvisible'
- and attr.is_visible_p = 't'
- } {
+ db_foreach feedback_nested_associated_items { *SQL* } {
imsld::process_resource_as_ul -resource_item_id $resource_item_id \
-run_id $run_id \
-dom_node $dom_node \
@@ -2176,65 +1515,7 @@
}
}
-ad_proc -public imsld::process_feedback {
- {-on_completion_item_id ""}
- {-community_id ""}
-} {
- returns a list with the feedback title and the associated resources, files and environments referenced from the on_completion element.
-} {
- set community_id [expr { [string eq "" $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]
-
- set feedback_item_id ""
-
- # get on completion info
- db_1row feedback_info {
- select coalesce(oc.feedback_title, oc.title) as feedback_title
- from imsld_on_completioni oc
- where oc.item_id = :on_completion_item_id
- and content_revision__is_live(oc.on_completion_id) = 't'
- }
-
- set feedback_items_list [list]
- # get the items associated with the feedback
- set linear_item_list [db_list item_linear_list {
- select ii.imsld_item_id
- from imsld_items ii,
- cr_items cr, acs_rels ar
- where ar.object_id_one = :on_completion_item_id
- and ar.object_id_two = cr.item_id
- and cr.live_revision = ii.imsld_item_id
- }]
- foreach imsld_item_id $linear_item_list {
- db_foreach feedback_nested_associated_items {
- select cpr.resource_id,
- cpr.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resourcesi cpr, imsld_itemsi ii,
- acs_rels ar
- where ar.object_id_one = ii.item_id
- and ar.object_id_two = cpr.item_id
- and content_revision__is_live(cpr.resource_id) = 't'
- and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- or ii.imsld_item_id = :imsld_item_id)
- } {
- set one_feedback_urls [imsld::process_resource -resource_item_id $resource_item_id]
- if { [string eq "" $one_feedback_urls] } {
- lappend feedback_items_list "[_ imsld.lt_li_desc_no_file_assoc]"
- } else {
- set feedback_items_list [concat [list $feedback_items_list] [list $one_feedback_urls]]
- }
- }
- }
- return [list $feedback_title $feedback_items_list]
-}
-
-ad_proc -public imsld::process_resource_as_ul {
+ad_proc -public imsld::process_resource_as_ul {
-resource_item_id
-run_id
{-community_id ""}
@@ -2260,31 +1541,15 @@
-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_resource_info {
- select identifier,
- type as resource_type,
- title as resource_title,
- acs_object_id
- from imsld_cp_resourcesi
- where item_id = :resource_item_id
- and content_revision__is_live(resource_id) = 't'
- }
+ db_1row get_resource_info { *SQL* }
set files_node [$dom_doc createElement ul]
if { ![string eq $resource_type "webcontent"] && ![string eq $acs_object_id ""] } {
# if the resource type is not webcontent or has an associated object_id (special cases)...
- if { [db_0or1row is_cr_item {
- select live_revision from cr_items where item_id = :acs_object_id
- }] } {
- db_1row get_cr_info {
- select acs_object__name(object_id) as object_title, object_type
- from acs_objects where object_id = :live_revision
- }
+ if { [db_0or1row is_cr_item { *SQL* }] } {
+ db_1row get_cr_info { *SQL* }
} else {
- db_1row get_ao_info {
- select acs_object__name(object_id) as object_title, object_type
- from acs_objects where object_id = :acs_object_id
- }
+ db_1row get_ao_info { *SQL* }
}
set file_url [acs_sc::invoke -contract FtsContentProvider -operation url -impl $object_type -call_args [list $acs_object_id]]
@@ -2305,34 +1570,14 @@
} else {
# is webcontent, let's get the associated files
- foreach file_list [db_list_of_lists associated_files {
- select cpf.imsld_file_id,
- cpf.file_name,
- cpf.item_id,
- cpf.parent_id
- from imsld_cp_filesx cpf,
- acs_rels ar
- where ar.object_id_one = :resource_item_id
- and ar.object_id_two = cpf.item_id
- and content_revision__is_live(cpf.imsld_file_id) = 't'
- }] {
+ foreach file_list [db_list_of_lists associated_files { *SQL* }] {
set imsld_file_id [lindex $file_list 0]
set file_name [lindex $file_list 1]
set item_id [lindex $file_list 2]
set parent_id [lindex $file_list 3]
- # get the fs file path
- set folder_path [db_exec_plsql get_folder_path { select content_item__get_path(:parent_id,:root_folder_id); }]
- set fs_file_url [db_1row get_fs_file_url {
- select
- case
- when :folder_path is null
- then fs.file_upload_name
- else :folder_path || '/' || fs.file_upload_name
- end as file_url
- from fs_objects fs
- where fs.live_revision = :imsld_file_id
-
- }]
+ # get the fs file path
+ set folder_path [db_exec_plsql get_folder_path { *SQL* }]
+ set fs_file_url [db_1row get_fs_file_url { *SQL* }]
set file_url "[apm_package_url_from_id $fs_package_id]view/${file_url}"
set a_node [$dom_doc createElement a]
$a_node setAttribute href "[export_vars -base "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]imsld-finish-resource" {file_url $file_url resource_item_id $resource_item_id run_id $run_id}]"
@@ -2350,13 +1595,7 @@
}
}
# get associated urls
- db_foreach associated_urls {
- select url
- from acs_rels ar,
- cr_extlinks links
- where ar.object_id_one = :resource_item_id
- and ar.object_id_two = links.extlink_id
- } {
+ db_foreach associated_urls { *SQL* } {
set a_node [$dom_doc createElement a]
$a_node setAttribute href "[export_vars -base "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]imsld-finish-resource" { {file_url "[export_vars -base $url]"} resource_item_id run_id}]"
@@ -2376,95 +1615,6 @@
}
}
-ad_proc -public imsld::process_resource {
- -resource_item_id
- {-community_id ""}
-} {
- @param resource_item_id
-
- @return The list of files associated to the given resource_id
-} {
- set community_id [expr { [string eq "" $community_id] ? "[dotlrn_community::get_community_id]" : $community_id }]
- db_1row get_resource_info {
- select identifier,
- type as resource_type,
- title as resource_title,
- acs_object_id
- from imsld_cp_resourcesi
- where item_id = :resource_item_id
- and content_revision__is_live(resource_id) = 't'
- }
- set files_urls ""
- if { ![string eq $resource_type "webcontent"] && ![string eq $acs_object_id ""] } {
- if { [db_0or1row is_cr_item {
- select live_revision from cr_items where item_id = :acs_object_id
- }] } {
- db_1row get_cr_info {
- select acs_object__name(object_id) as object_title, object_type
- from acs_objects where object_id = :live_revision
- }
- } else {
- db_1row get_ao_info {
- select acs_object__name(object_id) as object_title, object_type
- from acs_objects where object_id = :acs_object_id
- }
- }
- set file_url [acs_sc::invoke -contract FtsContentProvider -operation url -impl $object_type -call_args [list $acs_object_id]]
- set image_path [imsld::object_type_image_path -object_type $object_type]
- append files_urls " "
- } else {
- # Get 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]
- # get associated files
- foreach file_list [db_list_of_lists associated_files {
- select cpf.imsld_file_id,
- cpf.file_name,
- cpf.item_id,
- cpf.parent_id
- from imsld_cp_filesx cpf,
- acs_rels ar
- where ar.object_id_one = :resource_item_id
- and ar.object_id_two = cpf.item_id
- and content_revision__is_live(cpf.imsld_file_id) = 't'
- }] {
- set imsld_file_id [lindex $file_list 0]
- set file_name [lindex $file_list 1]
- set item_id [lindex $file_list 2]
- set parent_id [lindex $file_list 3]
- # get the fs file path
- set folder_path [db_exec_plsql get_folder_path { select content_item__get_path(:parent_id,:root_folder_id); }]
- set fs_file_url [db_1row get_fs_file_url {
- select
- case
- when :folder_path is null
- then fs.file_upload_name
- else :folder_path || '/' || fs.file_upload_name
- end as file_url
- from fs_objects fs
- where fs.live_revision = :imsld_file_id
-
- }]
- set file_url "[apm_package_url_from_id $fs_package_id]view/${file_url}"
- append files_urls " "
- }
- # get associated urls
- db_foreach associated_urls {
- select url
- from acs_rels ar,
- cr_extlinks links
- where ar.object_id_one = :resource_item_id
- and ar.object_id_two = links.extlink_id
- } {
-
- append files_urls " "
- }
- }
- return $files_urls
-}
-
ad_proc -public imsld::process_activity_as_ul {
-activity_item_id:required
-run_id:required
@@ -2655,20 +1805,7 @@
@return The list (activity_name, list of associated urls, using tdom) of the activity in the IMS-LD.
} {
set user_id [ad_conn user_id]
- if { ![db_0or1row activity_info {
- select on_completion_id as on_completion_item_id,
- prerequisite_id as prerequisite_item_id,
- learning_objective_id as learning_objective_item_id,
- activity_id,
- title as activity_title
- from imsld_learning_activitiesi, imsld_attribute_instances attr
- where item_id = :activity_item_id
- and content_revision__is_live(activity_id) = 't'
- and attr.owner_id = activity_id
- and attr.run_id = :run_id
- and attr.type = 'isvisible'
- and attr.is_visible_p = 't'
- }] } {
+ if { ![db_0or1row activity_info { *SQL* }] } {
# is visible is false, do not show anything
return
}
@@ -2680,51 +1817,22 @@
set text [$dom_doc createTextNode "[_ imsld.Material]"]
$description_head_node appendChild $text
$description_node appendChild $description_head_node
- set linear_item_list [db_list item_linear_list {
- select ii.imsld_item_id
- from imsld_items ii, imsld_activity_descs lad, imsld_learning_activitiesi la,
- cr_items cr1, cr_items cr2,
- acs_rels ar
- where la.item_id = :activity_item_id
- and la.activity_description_id = cr1.item_id
- and cr1.live_revision = lad.description_id
- and ar.object_id_one = la.activity_description_id
- and ar.object_id_two = cr2.item_id
- and cr2.live_revision = ii.imsld_item_id
- }]
+ set linear_item_list [db_list item_linear_list { *SQL* }]
+ set activity_items_list [list]
foreach imsld_item_id $linear_item_list {
- foreach la_items_list [db_list_of_lists la_nested_associated_items {
- select cpr.resource_id,
- cpr.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resourcesi cpr, imsld_itemsi ii, imsld_attribute_instances attr,
- acs_rels ar
- where ar.object_id_one = ii.item_id
- and ar.object_id_two = cpr.item_id
- and content_revision__is_live(cpr.resource_id) = 't'
- and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- or ii.imsld_item_id = :imsld_item_id)
- and attr.owner_id = ii.imsld_item_id
- and attr.run_id = :run_id
- and attr.type = 'isvisible'
- and attr.is_visible_p = 't'
- }] {
+ foreach la_items_list [db_list_of_lists la_nested_associated_items { *SQL* }] {
set resource_id [lindex $la_items_list 0]
set resource_item_id [lindex $la_items_list 1]
set resource_type [lindex $la_items_list 2]
- if { [string eq "t" $resource_mode] } {
- lappend la_resource_item_list $resource_item_id
- }
-
+
imsld::process_resource_as_ul -resource_item_id $resource_item_id \
-run_id $run_id \
-dom_doc $dom_doc \
-dom_node $description_node
if { [string eq "t" $resource_mode] } {
- lappend activity_items_list $la_resource_item_list
+ lappend activity_items_list $resource_item_id
}
}
}
@@ -2737,6 +1845,7 @@
set text [$dom_doc createTextNode "[_ imsld.Prerequisites]"]
$prerequisites_head_node appendChild $text
$prerequisites_node appendChild $prerequisites_head_node
+ set prerequisites_list [list]
if { ![string eq "" $prerequisite_item_id] } {
# add the prerequisite files as items of the list
@@ -2756,6 +1865,7 @@
set text [$dom_doc createTextNode "[_ imsld.Objectives]"]
$objectives_head_node appendChild $text
$objectives_node appendChild $objectives_head_node
+ set objectives_list [list]
if { ![string eq "" $learning_objective_item_id] } {
# add the prerequisite files as items of the list
@@ -2775,13 +1885,7 @@
set text [$dom_doc createTextNode "[_ imsld.Feedback]"]
$feedback_head_node appendChild $text
$feedback_node appendChild $feedback_head_node
- if { [db_0or1row completed_activity {
- select 1
- from imsld_status_user
- where user_id = :user_id
- and related_id = :activity_id
- and run_id = :run_id
- }] } {
+ if { [db_0or1row completed_activity { *SQL* }] } {
if { ![string eq "" $on_completion_item_id] } {
# the feedback is not processed to ckeck if all the activity resources have been finished
# so we don't need to store the result
@@ -2796,19 +1900,13 @@
if { [string eq "t" $resource_mode] } {
# get environments
set environments_list [list]
- set associated_environments_list [db_list la_associated_environments {
- select ar.object_id_two as environment_item_id
- from acs_rels ar
- where ar.object_id_one = :activity_item_id
- and ar.rel_type = 'imsld_la_env_rel'
- order by ar.object_id_two
- }]
+ set associated_environments_list [db_list la_associated_environments { *SQL* }]
foreach environment_item_id $associated_environments_list {
if { [llength $environments_list] } {
set environments_list [concat [list $environments_list] \
- [list [imsld::process_environment_as_ul -environment_item_id $environment_item_id -resource_mode $resource_mode -run_id $run_id]]]
+ [list [imsld::process_environment_as_ul -environment_item_id $environment_item_id -resource_mode $resource_mode -run_id $run_id -dom_node $dom_node -dom_doc $dom_doc]]]
} else {
- set environments_list [imsld::process_environment_as_ul -environment_item_id $environment_item_id -resource_mode $resource_mode -run_id $run_id]
+ set environments_list [imsld::process_environment_as_ul -environment_item_id $environment_item_id -resource_mode $resource_mode -run_id $run_id -dom_node $dom_node -dom_doc $dom_doc]
}
}
@@ -2823,125 +1921,6 @@
}
}
-ad_proc -public imsld::process_learning_activity {
- -activity_item_id:required
- {-resource_mode "f"}
-} {
- @param activity_item_id
- @option resource_mode default f
-
- @return The list (activity_name, list of associated urls) of the activity in the IMS-LD.
-} {
- db_1row activity_info {
- select on_completion_id as on_completion_item_id,
- prerequisite_id as prerequisite_item_id,
- learning_objective_id as learning_objective_item_id,
- activity_id
- from imsld_learning_activitiesi
- where item_id = :activity_item_id
- and content_revision__is_live(activity_id) = 't'
- }
-
- # get environments
- set environments_list [list]
- set associated_environments_list [db_list la_associated_environments {
- select ar.object_id_two as environment_item_id
- from acs_rels ar
- where ar.object_id_one = :activity_item_id
- and ar.rel_type = 'imsld_la_env_rel'
- order by ar.object_id_two
- }]
- foreach environment_item_id $associated_environments_list {
- if { [llength $environments_list] } {
- set environments_list [concat [list $environments_list] \
- [list [imsld::process_environment -environment_item_id $environment_item_id -resource_mode $resource_mode]]]
- } else {
- set environments_list [imsld::process_environment -environment_item_id $environment_item_id -resource_mode $resource_mode]
- }
- }
-
- # prerequisites
- set prerequisites_list [list]
- if { ![string eq "" $prerequisite_item_id] } {
- set prerequisites_list [imsld::process_prerequisite -activity_item_id $activity_item_id -resource_mode $resource_mode]
- }
- # learning objectives
- set objectives_list [list]
- if { ![string eq "" $learning_objective_item_id] } {
- set objectives_list [imsld::process_learning_objective -activity_item_id $activity_item_id -resource_mode $resource_mode]
- }
-
- set activity_items_list [list]
- # get the items associated with the activity
- set linear_item_list [db_list item_linear_list {
- select ii.imsld_item_id
- from imsld_items ii, imsld_activity_descs lad, imsld_learning_activitiesi la,
- cr_items cr1, cr_items cr2,
- acs_rels ar
- where la.item_id = :activity_item_id
- and la.activity_description_id = cr1.item_id
- and cr1.live_revision = lad.description_id
- and ar.object_id_one = la.activity_description_id
- and ar.object_id_two = cr2.item_id
- and cr2.live_revision = ii.imsld_item_id
- }]
- foreach imsld_item_id $linear_item_list {
- foreach la_items_list [db_list_of_lists la_nested_associated_items {
- select cpr.resource_id,
- cpr.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resourcesi cpr, imsld_itemsi ii,
- acs_rels ar
- where ar.object_id_one = ii.item_id
- and ar.object_id_two = cpr.item_id
- and content_revision__is_live(cpr.resource_id) = 't'
- and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- or ii.imsld_item_id = :imsld_item_id)
- }] {
- set resource_id [lindex $la_items_list 0]
- set resource_item_id [lindex $la_items_list 1]
- set resource_type [lindex $la_items_list 2]
- if {[string eq "t" $resource_mode] } {
- lappend la_resource_item_list $resource_item_id
- }
-
- set one_activity_urls "[imsld::process_resource -resource_item_id $resource_item_id]"
- if { [string eq "" $one_activity_urls] } {
- ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]"
- } else {
- if { [llength $activity_items_list] } {
- set activity_items_list [concat $activity_items_list [list $one_activity_urls]]
- } else {
- set activity_items_list [list $one_activity_urls]
- }
- }
- if {[string eq "t" $resource_mode] } {
- lappend activity_items_list $la_resource_item_list
- }
-
- }
- }
-
- # feedback
- set feedbacks_list [list]
- if { ![string eq "" $on_completion_item_id] } {
- set feedbacks_list [imsld::process_feedback -on_completion_item_id $on_completion_item_id]
- }
- if { [string eq "t" $resource_mode] } {
- #put in order the environments_id(s)
- set environments_ids [concat [lindex [lindex $environments_list 1] [expr [llength [lindex $environments_list 1] ] - 1 ]] \
- [lindex [lindex $environments_list 2] [expr [llength [lindex $environments_list 2] ] - 1 ]] ]
- return [list [lindex $prerequisites_list [expr [llength $prerequisites_list] - 1]] \
- [lindex $objectives_list [expr [llength $objectives_list ] - 1]] \
- $environments_ids \
- [lindex $activity_items_list [expr [llength $activity_items_list ] - 1]]]
-
- } else {
- return [list $prerequisites_list $objectives_list $environments_list $activity_items_list $feedbacks_list]
- }
-}
-
ad_proc -public imsld::process_support_activity_as_ul {
-activity_item_id:required
-run_id:required
@@ -2958,18 +1937,7 @@
@return The list of items (resources, feedback, environments, using tdom) associated with the support activity
} {
set user_id [ad_conn user_id]
- if { ![db_0or1row activity_info {
- select on_completion_id as on_completion_item_id,
- activity_id,
- attr.is_visible_p
- from imsld_support_activitiesi, imsld_attribute_instances attr
- where item_id = :activity_item_id
- and content_revision__is_live(activity_id) = 't'
- and attr.owner_id = activity_id
- and attr.run_id = :run_id
- and attr.type = 'isvisible'
- and attr.is_visible_p = 't'
- }] } {
+ if { ![db_0or1row activity_info { *SQL* }] } {
# is visible is false do not show anything
return
}
@@ -2981,36 +1949,9 @@
set text [$dom_doc createTextNode "[_ imsld.Material]"]
$description_head_node appendChild $text
$description_node appendChild $description_head_node
- set linear_item_list [db_list item_linear_list {
- select ii.imsld_item_id
- from imsld_items ii, imsld_activity_descs sad, imsld_support_activitiesi sa,
- cr_items cr1, cr_items cr2,
- acs_rels ar
- where sa.item_id = :activity_item_id
- and sa.activity_description_id = cr1.item_id
- and cr1.live_revision = sad.description_id
- and ar.object_id_one = sa.activity_description_id
- and ar.object_id_two = cr2.item_id
- and cr2.live_revision = ii.imsld_item_id
- }]
+ set linear_item_list [db_list item_linear_list { *SQL* }]
foreach imsld_item_id $linear_item_list {
- foreach sa_items_list [db_list_of_lists sa_nested_associated_items {
- select cpr.resource_id,
- cpr.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resourcesi cpr, imsld_itemsi ii, imsld_attribute_instances attr,
- acs_rels ar
- where ar.object_id_one = ii.item_id
- and ar.object_id_two = cpr.item_id
- and content_revision__is_live(cpr.resource_id) = 't'
- and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- or ii.imsld_item_id = :imsld_item_id)
- and attr.owner_id = ii.imsld_item_id
- and attr.run_id = :run_id
- and attr.type = 'isvisible'
- and attr.is_visible_p = 't'
- }] {
+ foreach sa_items_list [db_list_of_lists sa_nested_associated_items { *SQL* }] {
set resource_id [lindex $sa_items_list 0]
set resource_item_id [lindex $sa_items_list 1]
set resource_type [lindex $sa_items_list 2]
@@ -3037,13 +1978,7 @@
set text [$dom_doc createTextNode "[_ imsld.Feedback]"]
$feedback_head_node appendChild $text
$feedback_node appendChild $feedback_head_node
- if { [db_0or1row completed_activity {
- select 1
- from imsld_status_user
- where user_id = :user_id
- and related_id = :activity_id
- and run_id = :run_id
- }] } {
+ if { [db_0or1row completed_activity { *SQL* }] } {
if { ![string eq "" $on_completion_item_id] } {
# the feedback is not processed to ckeck if all the activity resources have been finished
# so we don't need to store the result
@@ -3058,19 +1993,13 @@
if { [string eq "t" $resource_mode] } {
# get environments
set environments_list [list]
- set associated_environments_list [db_list sa_associated_environments {
- select ar.object_id_two as environment_item_id
- from acs_rels ar
- where ar.object_id_one = :activity_item_id
- and ar.rel_type = 'imsld_sa_env_rel'
- order by ar.object_id_two
- }]
+ set associated_environments_list [db_list sa_associated_environments { *SQL* }]
foreach environment_item_id $associated_environments_list {
if { [llength $environments_list] } {
set environments_list [concat [list $environments_list] \
- [list [imsld::process_environment_as_ul -environment_item_id $environment_item_id -run_id $run_id -resource_mode $resource_mode]]]
+ [list [imsld::process_environment_as_ul -environment_item_id $environment_item_id -run_id $run_id -resource_mode $resource_mode -dom_node $dom_node -dom_doc $dom_doc]]]
} else {
- set environments_list [imsld::process_environment_as_ul -environment_item_id $environment_item_id -run_id $run_id -resource_mode $resource_mode]
+ set environments_list [imsld::process_environment_as_ul -environment_item_id $environment_item_id -run_id $run_id -resource_mode $resource_mode -dom_node $dom_node -dom_doc $dom_doc]
}
}
@@ -3083,109 +2012,6 @@
}
}
-ad_proc -public imsld::process_support_activity {
- -activity_item_id:required
- {-community_id ""}
- {-resource_mode "f"}
-} {
- @param activity_item_id
-
- @return The list of items (resources, feedback, environments) associated with the support activity
-} {
- db_1row activity_info {
- select on_completion_id as on_completion_item_id,
- activity_id
- from imsld_support_activitiesi
- where item_id = :activity_item_id
- and content_revision__is_live(activity_id) = 't'
- }
- # get environments
- set environments_list [list]
- set associated_environments_list [db_list sa_associated_environments {
- select ar.object_id_two as environment_item_id
- from acs_rels ar
- where ar.object_id_one = :activity_item_id
- and ar.rel_type = 'imsld_sa_env_rel'
- order by ar.object_id_two
- }]
- foreach environment_item_id $associated_environments_list {
- if { [llength $environments_list] } {
- set environments_list [concat [list $environments_list] \
- [list [imsld::process_environment -environment_item_id $environment_item_id -resource_mode $resource_mode]]]
- } else {
- set environments_list [imsld::process_environment -environment_item_id $environment_item_id -resource_mode $resource_mode]
- }
- }
-
- set activity_items_list [list]
- # get the items associated with the activity
- set linear_item_list [db_list item_linear_list {
- select ii.imsld_item_id
- from imsld_items ii, imsld_activity_descs sad, imsld_support_activitiesi sa,
- cr_items cr1, cr_items cr2,
- acs_rels ar
- where sa.item_id = :activity_item_id
- and sa.activity_description_id = cr1.item_id
- and cr1.live_revision = sad.description_id
- and ar.object_id_one = sa.activity_description_id
- and ar.object_id_two = cr2.item_id
- and cr2.live_revision = ii.imsld_item_id
- }]
- foreach imsld_item_id $linear_item_list {
- foreach sa_items_list [db_list_of_lists sa_nested_associated_items {
- select cpr.resource_id,
- cpr.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resourcesi cpr, imsld_itemsi ii,
- acs_rels ar
- where ar.object_id_one = ii.item_id
- and ar.object_id_two = cpr.item_id
- and content_revision__is_live(cpr.resource_id) = 't'
- and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- or ii.imsld_item_id = :imsld_item_id)
- }] {
- set resource_id [lindex $sa_items_list 0]
- set resource_item_id [lindex $sa_items_list 1]
- set resource_type [lindex $sa_items_list 2]
- if {[string eq "t" $resource_mode] } {
- lappend sa_resource_item_list $resource_item_id
- }
-
- set one_activity_urls "[imsld::process_resource -resource_item_id $resource_item_id]"
- if { [string eq "" $one_activity_urls] } {
- ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]"
- } else {
- if { [llength $activity_items_list] } {
- set activity_items_list [concat $activity_items_list [list $one_activity_urls]]
- } else {
- set activity_items_list [list $one_activity_urls]
- }
- }
- if {[string eq "t" $resource_mode] } {
- lappend activity_items_list $sa_resource_item_list
- }
- }
- }
-
- # feedback
- set feedbacks_list [list]
- if { ![string eq "" $on_completion_item_id] } {
- set feedbacks_list [imsld::process_feedback -on_completion_item_id $on_completion_item_id]
- }
- if { [string eq "t" $resource_mode] } {
- #put in order the environments_id(s)
- set environments_ids [concat [lindex [lindex $environments_list 1] [expr [llength [lindex $environments_list 1] ] - 1 ]] \
- [lindex [lindex $environments_list 2] [expr [llength [lindex $environments_list 2] ] - 1 ]] ]
-
- return [list $environments_ids \
- [lindex $activity_items_list [expr [llength $activity_items_list ] - 1]]]
-
- } else {
- return [list $environments_list $activity_items_list $feedbacks_list]
- }
-}
-
ad_proc -public imsld::process_activity_structure_as_ul {
-structure_item_id:required
-run_id:required
@@ -3211,38 +2037,16 @@
set text [$dom_doc createTextNode ""]
$info_node appendChild $text
- set linear_item_list [db_list item_linear_list {
- select ii.imsld_item_id
- from imsld_itemsi ii, acs_rels ar
- where ar.object_id_one = :structure_item_id
- and ar.rel_type = 'imsld_as_info_i_rel'
- and ar.object_id_two = ii.item_id
- and content_revision__is_live(ii.imsld_item_id) = 't'
- }]
+ set linear_item_list [db_list item_linear_list { *SQL* }]
+ set resource_items_list [list]
foreach imsld_item_id $linear_item_list {
- foreach la_items_list [db_list_of_lists la_nested_associated_items {
- select cpr.resource_id,
- cpr.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resourcesi cpr, imsld_itemsi ii, imsld_attribute_instances attr,
- acs_rels ar
- where ar.object_id_one = ii.item_id
- and ar.object_id_two = cpr.item_id
- and content_revision__is_live(cpr.resource_id) = 't'
- and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- or ii.imsld_item_id = :imsld_item_id)
- and attr.owner_id = ii.imsld_item_id
- and attr.run_id = :run_id
- and attr.type = 'isvisible'
- and attr.is_visible_p = 't'
- }] {
+ foreach la_items_list [db_list_of_lists as_nested_associated_items { *SQL* }] {
set resource_id [lindex $la_items_list 0]
set resource_item_id [lindex $la_items_list 1]
set resource_type [lindex $la_items_list 2]
if { [string eq "t" $resource_mode] } {
- lappend as_resource_item_list $resource_item_id
+ lappend resource_items_list $resource_item_id
}
imsld::process_resource_as_ul -resource_item_id $resource_item_id \
@@ -3254,37 +2058,10 @@
$info_tab_node appendChild $info_node
$dom_node appendChild $info_tab_node
if { [string eq "t" $resource_mode] } {
- return $as_resource_item_list
+ return $resource_items_list
}
}
-ad_proc -public imsld::process_activity_structure {
- -structure_item_id:required
- {-resource_mode "f"}
-} {
- @param structure_item_id
-
- @return The list of items (environments) associated with the activity structure
-} {
- # get environments
- set environments_list [list]
- set associated_environments_list [db_list sa_associated_environments { *SQL* }]
- foreach environment_item_id $associated_environments_list {
- if { [llength $environments_list] } {
- set environments_list [concat $environments_list \
- [list [imsld::process_environment -environment_item_id $environment_item_id -resource_mode $resource_mode]]]
- } else {
- set environments_list [imsld::process_environment -environment_item_id $environment_item_id -resource_mode $resource_mode]
- }
- }
- if { [string eq "t" $resource_mode] } {
- #put in order the environments_id(s)
- set environments_ids [concat [lindex [lindex $environments_list 1] [expr [llength [lindex $environments_list 1] ] - 1 ]] \
- [lindex [lindex $environments_list 2] [expr [llength [lindex $environments_list 2] ] - 1 ]]]
- }
- return $environments_list
-}
-
ad_proc -public imsld::generate_structure_activities_list {
-imsld_id
-run_id
@@ -3689,7 +2466,7 @@
where content_revision__is_live(irp.role_part_id)='t'
and irp.act_id=:act_item_id
and irp.role_id=iri.item_id
- and iri.role_id in ([join $user_roles_list ","])
+ and iri.role_id in ([join $user_roles_list ","])
"] {
db_1row get_role_part_activity {
select case
@@ -3959,15 +2736,18 @@
db_dml insert_completed_resource { *SQL* }
}
#find all the resouces in the same activity
+
+ dom createDocument foo foo_doc
+ set foo_node [$foo_doc documentElement]
switch $activity_type {
learning {
- set first_resources_item_list [imsld::process_learning_activity -activity_item_id $activity_item_id -resource_mode "t"]
+ set first_resources_item_list [imsld::process_learning_activity_as_ul -run_id $run_id -activity_item_id $activity_item_id -resource_mode "t" -dom_node $foo_node -dom_doc $foo_doc]
}
support {
- set first_resources_item_list [imsld::process_support_activity -activity_item_id $activity_item_id -resource_mode "t"]
+ set first_resources_item_list [imsld::process_support_activity_as_ul -run_id $run_id -activity_item_id $activity_item_id -resource_mode "t" -dom_node $foo_node -dom_doc $foo_doc]
}
structure {
- set first_resources_item_list [imsld::process_activity_structure -structure_item_id $activity_item_id -resource_mode "t"]
+ set first_resources_item_list [imsld::process_activity_structure_as_ul -run_id $run_id -structure_item_id $activity_item_id -resource_mode "t" -dom_node $foo_node -dom_doc $foo_doc]
}
}
Index: openacs-4/packages/imsld/tcl/imsld-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs.xql,v
diff -u -N -r1.21 -r1.22
--- openacs-4/packages/imsld/tcl/imsld-procs.xql 18 May 2006 11:13:00 -0000 1.21
+++ openacs-4/packages/imsld/tcl/imsld-procs.xql 29 May 2006 15:10:52 -0000 1.22
@@ -6,9 +6,10 @@
select dc.community_id
- from imsld_cp_manifestsi im, acs_objects ao, dotlrn_communities dc
- where im.object_package_id = ao.package_id
- and ao.context_id = dc.package_id
+ from imsld_cp_manifestsi im, dotlrn_communities dc, acs_objects ao, acs_objects ao2
+ where im.item_id = ao.object_id
+ and ao.context_id = ao2.object_id
+ and ao2.context_id = dc.package_id
and im.manifest_id = :manifest_id
@@ -19,17 +20,20 @@
select icm.manifest_id,
ii.imsld_id,
- im.method_id,
+ im.method_id,
+ ir.run_id,
ca.time_in_seconds,
- icm.creation_date
+ ao.creation_date
from imsld_cp_manifestsi icm, imsld_cp_organizationsi ico,
- imsld_imsldsi ii, imsld_methodsi im, imsld_complete_actsi ca
+ imsld_imsldsi ii, imsld_methodsi im, imsld_complete_actsi ca, imsld_runs ir, acs_objects ao
where im.imsld_id = ii.item_id
+ and ii.imsld_id = ir.imsld_id
and ii.organization_id = ico.item_id
and ico.manifest_id = icm.item_id
and im.complete_act_id = ca.item_id
and ca.time_in_seconds is not null
- and content_revision__is_live(im.method_id) = 't'
+ and ao.object_id = ir.run_id
+ and content_revision__is_live(ii.imsld_id) = 't'
@@ -44,13 +48,16 @@
-
+
- select app.user_id
- from dotlrn_member_rels_approved app
- where app.community_id = :community_id
- and app.member_state = 'approved'
-
+ select u.user_id
+ from users u,
+ acs_rels ar,
+ imsld_run_users_group_ext r_map
+ where u.user_id > 0
+ and u.user_id=ar.object_id_two
+ and ar.object_id_one = r_map.group_id
+ and r_map.run_id = :run_id
@@ -61,52 +68,50 @@
ii.imsld_id,
ip.play_id,
ca.time_in_seconds,
- icm.creation_date
+ ao.creation_date,
+ ir.run_id
from imsld_cp_manifestsi icm, imsld_cp_organizationsi ico,
imsld_imsldsi ii, imsld_methodsi im, imsld_plays ip,
- imsld_complete_actsi ca
+ imsld_complete_actsi ca, imsld_runs ir, acs_objects ao
where ip.method_id = im.item_id
and im.imsld_id = ii.item_id
and ii.organization_id = ico.item_id
and ico.manifest_id = icm.item_id
and ip.complete_act_id = ca.item_id
and ca.time_in_seconds is not null
- and content_revision__is_live(ip.play_id) = 't'
-
+ and ao.object_id = ir.run_id
+ and content_revision__is_live(ii.imsld_id) = 't'
+ and ii.imsld_id = ir.imsld_id
+
-
-
-
-
select icm.manifest_id,
ii.imsld_id,
ip.play_id,
ia.act_id,
ca.time_in_seconds,
- icm.creation_date
+ icm.creation_date,
+ ir.run_id
from imsld_cp_manifestsi icm, imsld_cp_organizationsi ico,
imsld_imsldsi ii, imsld_methodsi im, imsld_playsi ip, imsld_acts ia,
- imsld_complete_actsi ca
+ imsld_complete_actsi ca, imsld_runs ir, acs_objects ao
where ia.play_id = ip.item_id
and ip.method_id = im.item_id
and im.imsld_id = ii.item_id
and ii.organization_id = ico.item_id
and ico.manifest_id = icm.item_id
and ia.complete_act_id = ca.item_id
and ca.time_in_seconds is not null
- and content_revision__is_live(ia.act_id) = 't'
-
+ and ao.object_id = ir.run_id
+ and content_revision__is_live(ii.imsld_id) = 't'
+ and ii.imsld_id = ir.imsld_id
+
-
-
-
-
select sa.item_id as sa_item_id,
@@ -121,25 +126,29 @@
-
+
select icm.manifest_id,
+ irp.role_part_id,
ii.imsld_id,
ip.play_id,
ia.act_id,
- icm.creation_date
+ ao.creation_date,
+ ir.run_id
from imsld_cp_manifestsi icm, imsld_cp_organizationsi ico,
imsld_imsldsi ii, imsld_methodsi im, imsld_playsi ip,
- imsld_actsi ia, imsld_role_partsi irp
- where irp.role_part_id = :role_part_id
+ imsld_actsi ia, imsld_role_partsi irp, imsld_runs ir, acs_objects ao
+ where irp.support_activity_id = :sa_item_id
and irp.act_id = ia.item_id
and ia.play_id = ip.item_id
and ip.method_id = im.item_id
and im.imsld_id = ii.item_id
and ii.organization_id = ico.item_id
+ and ii.imsld_id = ir.imsld_id
+ and ao.object_id = ir.run_id
and ico.manifest_id = icm.item_id
- and content_revision__is_live(icm.manifest_id) = 't'
-
+ and content_revision__is_live(ii.imsld_id) = 't'
+
@@ -157,25 +166,30 @@
-
+
+
select icm.manifest_id,
+ irp.role_part_id,
ii.imsld_id,
ip.play_id,
ia.act_id,
- icm.creation_date
+ ao.creation_date,
+ ir.run_id
from imsld_cp_manifestsi icm, imsld_cp_organizationsi ico,
imsld_imsldsi ii, imsld_methodsi im, imsld_playsi ip,
- imsld_actsi ia, imsld_role_partsi irp
+ imsld_actsi ia, imsld_role_partsi irp, imsld_runs ir, acs_objects ao
where irp.role_part_id = :role_part_id
and irp.act_id = ia.item_id
and ia.play_id = ip.item_id
and ip.method_id = im.item_id
and im.imsld_id = ii.item_id
and ii.organization_id = ico.item_id
+ and ii.imsld_id = ir.imsld_id
+ and ao.object_id = ir.run_id
and ico.manifest_id = icm.item_id
- and content_revision__is_live(icm.manifest_id) = 't'
-
+ and content_revision__is_live(ii.imsld_id) = 't'
+
@@ -841,37 +855,40 @@
-
+
+
select serv.service_id,
serv.identifier,
- serv.class,
- serv.is_visible_p,
- serv.service_type
- from imsld_servicesi serv
+ serv.service_type,
+ serv.title as service_title
+ from imsld_servicesi serv
where serv.item_id = :service_item_id
and content_revision__is_live(serv.service_id) = 't'
-
+
-
+
+
select conf.conference_id,
conf.conference_type,
conf.imsld_item_id as imsld_item_item_id,
- cr.live_revision as imsld_item_id
- from imsld_conference_services conf, cr_items cr
+ cr.live_revision as imsld_item_id,
+ conf.title as conf_title
+ from imsld_conference_servicesi conf, cr_items cr
where conf.service_id = :service_item_id
and cr.item_id = conf.imsld_item_id
and content_revision__is_live(cr.live_revision) = 't'
-
+
-
+
+
select cpr.resource_id,
cpr.item_id as resource_item_id,
cpr.type as resource_type
@@ -883,39 +900,24 @@
and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
or ii.imsld_item_id = :imsld_item_id)
-
-
-
-
-
- select mail_id as sendmail_id
- from imsld_send_mail_servicesi isms
- where isms.service_id=:service_item_id
-
+
-
-
+
- select mail_id as sendmail_id
- from imsld_send_mail_servicesi isms
- where isms.service_id=:service_item_id
-
-
-
-
- select role_id as role_destination_ref
- from imsld_send_mail_servicesi isms,
- imsld_send_mail_data ismd
- where isms.service_id=:service_item_id
- and isms.item_id=ismd.send_mail_id
-
+ select sm.title as send_mail_title, sm.mail_id as sendmail_id
+ from imsld_send_mail_servicesi sm
+ where sm.service_id = :service_item_id
+ and content_revision__is_live(sm.mail_id) = 't'
+
+
-
-
+
+
+
select env.title as environment_title,
env.environment_id
from imsld_environmentsi env
@@ -926,22 +928,30 @@
-
+
+
select item_id as learning_object_item_id,
learning_object_id,
- identifier
- from imsld_learning_objectsi
+ identifier,
+ coalesce(title,identifier) as lo_title,
+ class
+ from imsld_learning_objectsi, imsld_attribute_instances attr
where environment_id = :environment_item_id
and content_revision__is_live(learning_object_id) = 't'
-
+ and attr.owner_id = learning_object_id
+ and attr.run_id = :run_id
+ and attr.type = 'isvisible'
+ and attr.is_visible_p = 't'
+ order by creation_date
+
-
+
-
+
select ii.imsld_item_id
from imsld_items ii,
cr_items cr,
@@ -954,53 +964,67 @@
-
+
- select cpr.resource_id,
- cr2.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resources cpr, imsld_items ii,
- acs_rels ar, cr_items cr1, cr_items cr2
- where ar.object_id_one = cr1.item_id
- and ar.object_id_two = cr2.item_id
- and cr1.live_revision = ii.imsld_item_id
- and cr2.live_revision = cpr.resource_id
+
+
+ select cpr.resource_id,
+ cr2.item_id as resource_item_id,
+ cpr.type as resource_type
+ from imsld_cp_resources cpr, imsld_items ii, imsld_attribute_instances attr,
+ acs_rels ar, cr_items cr1, cr_items cr2
+ where ar.object_id_one = cr1.item_id
+ and ar.object_id_two = cr2.item_id
+ and cr1.live_revision = ii.imsld_item_id
+ and cr2.live_revision = cpr.resource_id
and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
or ii.imsld_item_id = :imsld_item_id)
+ and attr.owner_id = ii.imsld_item_id
+ and attr.run_id = :run_id
+ and attr.type = 'isvisible'
+ and attr.is_visible_p = 't'
-
+
+
select service_id,
item_id as service_item_id,
identifier,
- service_type
- from imsld_servicesi
+ service_type,
+ title as service_title,
+ class
+ from imsld_servicesi, imsld_attribute_instances attr
where environment_id = :environment_item_id
and content_revision__is_live(service_id) = 't'
-
+ and attr.owner_id = service_id
+ and attr.run_id = :run_id
+ and attr.type = 'isvisible'
+ and attr.is_visible_p = 't'
+
-
+
+
select ar.object_id_two as nested_environment_item_id
from acs_rels ar
where ar.object_id_one = :environment_item_id
and ar.rel_type = 'imsld_env_env_rel'
-
+
-
+
-
+
select learning_objective_id as learning_objective_item_id
from imsld_imsldsi
where item_id = :imsld_item_id
@@ -1010,89 +1034,96 @@
-
+
-
+
select learning_objective_id as learning_objective_item_id
from imsld_learning_activitiesi
where item_id = :activity_item_id
and content_revision__is_live(activity_id) = 't'
-
+
-
+
- select coalesce(lo.pretty_title, '') as objective_title,
+
+ select lo.pretty_title as objective_title,
lo.learning_objective_id
from imsld_learning_objectivesi lo
where lo.item_id = :learning_objective_item_id
and content_revision__is_live(lo.learning_objective_id) = 't'
-
-
+
+
-
+
+
select ii.imsld_item_id
from imsld_items ii,
cr_items cr, acs_rels ar
where ar.object_id_one = :learning_objective_item_id
and ar.object_id_two = cr.item_id
and cr.live_revision = ii.imsld_item_id
-
+
-
+
- select cpr.resource_id,
- cr2.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resources cpr, imsld_items ii,
- acs_rels ar, cr_items cr1, cr_items cr2
- where ar.object_id_one = cr1.item_id
- and ar.object_id_two = cr2.item_id
- and cr1.live_revision = ii.imsld_item_id
- and cr2.live_revision = cpr.resource_id
+
+ select cpr.resource_id,
+ cpr.item_id as resource_item_id,
+ cpr.type as resource_type
+ from imsld_cp_resourcesi cpr, imsld_itemsi ii, imsld_attribute_instances attr,
+ acs_rels ar
+ where ar.object_id_one = ii.item_id
+ and ar.object_id_two = cpr.item_id
+ and content_revision__is_live(cpr.resource_id) = 't'
and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
or ii.imsld_item_id = :imsld_item_id)
-
+ and attr.owner_id = ii.imsld_item_id
+ and attr.run_id = :run_id
+ and attr.type = 'isvisible'
+ and attr.is_visible_p = 't'
+
-
+
- select prerequisite_id as prerequisite_item_id
+ select prerequisite_id as prerequisite_item_id
from imsld_imsldsi
where item_id = :imsld_item_id
and content_revision__is_live(imsld_id) = 't'
-
+
-
+
-
+
select prerequisite_id as prerequisite_item_id
from imsld_learning_activitiesi
where item_id = :activity_item_id
and content_revision__is_live(activity_id) = 't'
-
+
-
+
- select pre.pretty_title as prerequisite_title,
+
+ select coalesce(pre.pretty_title, '') as prerequisite_title,
pre.prerequisite_id
from imsld_prerequisitesi pre
where pre.item_id = :prerequisite_item_id
@@ -1102,51 +1133,58 @@
-
+
+
select ii.imsld_item_id
from imsld_items ii,
cr_items cr, acs_rels ar
where ar.object_id_one = :prerequisite_item_id
and ar.object_id_two = cr.item_id
and cr.live_revision = ii.imsld_item_id
-
+
-
+
- select cpr.resource_id,
- cr2.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resources cpr, imsld_items ii,
- acs_rels ar, cr_items cr1, cr_items cr2
- where ar.object_id_one = cr1.item_id
- and ar.object_id_two = cr2.item_id
- and cr1.live_revision = ii.imsld_item_id
- and cr2.live_revision = cpr.resource_id
+
+ select cpr.resource_id,
+ cpr.item_id as resource_item_id,
+ cpr.type as resource_type
+ from imsld_cp_resourcesi cpr, imsld_itemsi ii, imsld_attribute_instances attr,
+ acs_rels ar
+ where ar.object_id_one = ii.item_id
+ and ar.object_id_two = cpr.item_id
+ and content_revision__is_live(cpr.resource_id) = 't'
and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
or ii.imsld_item_id = :imsld_item_id)
-
+ and attr.owner_id = ii.imsld_item_id
+ and attr.run_id = :run_id
+ and attr.type = 'isvisible'
+ and attr.is_visible_p = 't'
+
-
+
- select oc.feedback_title as feedback_title
+
+ select coalesce(oc.feedback_title, oc.title) as feedback_title
from imsld_on_completioni oc
where oc.item_id = :on_completion_item_id
and content_revision__is_live(oc.on_completion_id) = 't'
-
+
-
+
+
select ii.imsld_item_id
from imsld_items ii,
cr_items cr, acs_rels ar
@@ -1158,49 +1196,53 @@
-
+
- select cpr.resource_id,
- cr2.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resources cpr, imsld_items ii,
- acs_rels ar, cr_items cr1, cr_items cr2
- where ar.object_id_one = cr1.item_id
- and ar.object_id_two = cr2.item_id
- and cr1.live_revision = ii.imsld_item_id
- and cr2.live_revision = cpr.resource_id
+
+ select cpr.resource_id,
+ cpr.item_id as resource_item_id,
+ cpr.type as resource_type
+ from imsld_cp_resourcesi cpr, imsld_itemsi ii, imsld_attribute_instances attr,
+ acs_rels ar
+ where ar.object_id_one = ii.item_id
+ and ar.object_id_two = cpr.item_id
+ and content_revision__is_live(cpr.resource_id) = 't'
and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
or ii.imsld_item_id = :imsld_item_id)
-
+ and attr.owner_id = ii.imsld_item_id
+ and attr.run_id = :run_id
+ and attr.type = 'isvisible'
+ and attr.is_visible_p = 't'
+
-
+
- select cpr.identifier,
- cpr.type as resource_type,
- cr.title as resource_title,
+
+ select identifier,
+ type as resource_type,
+ title as resource_title,
acs_object_id
- from imsld_cp_resources cpr, cr_revisions cr, cr_items cri
- where cr.item_id = :resource_item_id
- and cr.revision_id = cri.live_revision
- and cr.revision_id = cpr.resource_id
+ from imsld_cp_resourcesi
+ where item_id = :resource_item_id
+ and content_revision__is_live(resource_id) = 't'
-
+
select live_revision from cr_items where item_id = :acs_object_id
-
+
select acs_object__name(object_id) as object_title, object_type
@@ -1210,7 +1252,7 @@
-
+
select acs_object__name(object_id) as object_title, object_type
@@ -1220,31 +1262,35 @@
-
+
+
select cpf.imsld_file_id,
cpf.file_name,
- cr.item_id,
- cr.parent_id
- from imsld_cp_files cpf, cr_items cr,
- acs_rels ar
+ cpf.item_id,
+ cpf.parent_id
+ from imsld_cp_filesx cpf,
+ acs_rels ar, imsld_res_files_rels map
where ar.object_id_one = :resource_item_id
- and ar.object_id_two = cr.item_id
- and cpf.imsld_file_id = cr.live_revision
-
+ and ar.object_id_two = cpf.item_id
+ and ar.rel_id = map.rel_id
+ and content_revision__is_live(cpf.imsld_file_id) = 't'
+ and map.displayable_p = 't'
+
-
+
select content_item__get_path(:parent_id,:root_folder_id);
-
+
+
select
case
when :folder_path is null
@@ -1253,176 +1299,246 @@
end as file_url
from fs_objects fs
where fs.live_revision = :imsld_file_id
-
+
-
+
+
select url
from acs_rels ar,
- cr_extlinks links
+ cr_extlinks links,
+ imsld_res_files_rels map
where ar.object_id_one = :resource_item_id
and ar.object_id_two = links.extlink_id
+ and ar.rel_id = map.rel_id
+ and map.displayable_p = 't'
-
+
+
select on_completion_id as on_completion_item_id,
prerequisite_id as prerequisite_item_id,
learning_objective_id as learning_objective_item_id,
- activity_id
- from imsld_learning_activitiesi
+ activity_id,
+ title as activity_title
+ from imsld_learning_activitiesi, imsld_attribute_instances attr
where item_id = :activity_item_id
and content_revision__is_live(activity_id) = 't'
-
+ and attr.owner_id = activity_id
+ and attr.run_id = :run_id
+ and attr.type = 'isvisible'
+ and attr.is_visible_p = 't'
+
-
-
+
- select ar.object_id_two as environment_item_id
- from acs_rels ar
- where ar.object_id_one = :activity_item_id
- and ar.rel_type = 'imsld_la_env_rel'
- order by ar.object_id_two
-
-
-
-
-
-
select ii.imsld_item_id
- from imsld_items ii, imsld_activity_descs lad, imsld_learning_activities la,
- cr_items cr1, cr_items cr2, cr_items cr3,
+ from imsld_items ii, imsld_activity_descs lad, imsld_learning_activitiesi la,
+ cr_items cr1, cr_items cr2,
acs_rels ar
- where cr3.item_id = :activity_item_id
+ where la.item_id = :activity_item_id
and la.activity_description_id = cr1.item_id
and cr1.live_revision = lad.description_id
and ar.object_id_one = la.activity_description_id
and ar.object_id_two = cr2.item_id
and cr2.live_revision = ii.imsld_item_id
- and cr3.live_revision = la.activity_id
-
+
- select cpr.resource_id,
- cr2.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resources cpr, imsld_items ii,
- acs_rels ar, cr_items cr1, cr_items cr2
- where ar.object_id_one = cr1.item_id
- and ar.object_id_two = cr2.item_id
- and cr1.live_revision = ii.imsld_item_id
- and cr2.live_revision = cpr.resource_id
+
+ select cpr.resource_id,
+ cpr.item_id as resource_item_id,
+ cpr.type as resource_type
+ from imsld_cp_resourcesi cpr, imsld_itemsi ii, imsld_attribute_instances attr,
+ acs_rels ar
+ where ar.object_id_one = ii.item_id
+ and ar.object_id_two = cpr.item_id
+ and content_revision__is_live(cpr.resource_id) = 't'
and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
or ii.imsld_item_id = :imsld_item_id)
-
+ and attr.owner_id = ii.imsld_item_id
+ and attr.run_id = :run_id
+ and attr.type = 'isvisible'
+ and attr.is_visible_p = 't'
+
+
+
+
+ select 1
+ from imsld_status_user
+ where user_id = :user_id
+ and related_id = :activity_id
+ and run_id = :run_id
-
+
+
+
+
- select on_completion_id as on_completion_item_id,
- activity_id
- from imsld_support_activitiesi
- where item_id = :activity_item_id
- and content_revision__is_live(activity_id) = 't'
+
+ select ar.object_id_two as environment_item_id
+ from acs_rels ar
+ where ar.object_id_one = :activity_item_id
+ and ar.rel_type = 'imsld_la_env_rel'
+ order by ar.object_id_two
-
+
+
- select ar.object_id_two as environment_item_id
- from acs_rels ar
- where ar.object_id_one = :activity_item_id
- and ar.rel_type = 'imsld_sa_env_rel'
- order by ar.object_id_two
-
+
+ select on_completion_id as on_completion_item_id,
+ activity_id,
+ attr.is_visible_p
+ from imsld_support_activitiesi, imsld_attribute_instances attr
+ where item_id = :activity_item_id
+ and content_revision__is_live(activity_id) = 't'
+ and attr.owner_id = activity_id
+ and attr.run_id = :run_id
+ and attr.type = 'isvisible'
+ and attr.is_visible_p = 't'
+
-
+
+
select ii.imsld_item_id
- from imsld_items ii, imsld_activity_descs sad, imsld_support_activities sa,
- cr_items cr1, cr_items cr2, cr_items cr3,
+ from imsld_items ii, imsld_activity_descs sad, imsld_support_activitiesi sa,
+ cr_items cr1, cr_items cr2,
acs_rels ar
- where cr3.item_id = :activity_item_id
+ where sa.item_id = :activity_item_id
and sa.activity_description_id = cr1.item_id
and cr1.live_revision = sad.description_id
and ar.object_id_one = sa.activity_description_id
and ar.object_id_two = cr2.item_id
and cr2.live_revision = ii.imsld_item_id
- and cr3.live_revision = sa.activity_id
-
+
-
+
- select cpr.resource_id,
- cr2.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resources cpr, imsld_items ii,
- acs_rels ar, cr_items cr1, cr_items cr2
- where ar.object_id_one = cr1.item_id
- and ar.object_id_two = cr2.item_id
- and cr1.live_revision = ii.imsld_item_id
- and cr2.live_revision = cpr.resource_id
+
+ select cpr.resource_id,
+ cpr.item_id as resource_item_id,
+ cpr.type as resource_type
+ from imsld_cp_resourcesi cpr, imsld_itemsi ii, imsld_attribute_instances attr,
+ acs_rels ar
+ where ar.object_id_one = ii.item_id
+ and ar.object_id_two = cpr.item_id
+ and content_revision__is_live(cpr.resource_id) = 't'
and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
or ii.imsld_item_id = :imsld_item_id)
+ and attr.owner_id = ii.imsld_item_id
+ and attr.run_id = :run_id
+ and attr.type = 'isvisible'
+ and attr.is_visible_p = 't'
+
+
+
+
+
+
+
+
+ select 1
+ from imsld_status_user
+ where user_id = :user_id
+ and related_id = :activity_id
+ and run_id = :run_id
+
+
-
+ select ar.object_id_two as environment_item_id
+ from acs_rels ar
+ where ar.object_id_one = :activity_item_id
+ and ar.rel_type = 'imsld_sa_env_rel'
+ order by ar.object_id_two
+
+
+
+
+
-
- select ar.object_id_two as environment_item_id
- from acs_rels ar
+
+ select ii.imsld_item_id
+ from imsld_itemsi ii, acs_rels ar
where ar.object_id_one = :structure_item_id
- and ar.rel_type = 'imsld_as_env_rel'
- order by ar.object_id_two
-
-
+ and ar.rel_type = 'imsld_as_info_i_rel'
+ and ar.object_id_two = ii.item_id
+ and content_revision__is_live(ii.imsld_item_id) = 't'
+
-
+
+
+
+ select cpr.resource_id,
+ cpr.item_id as resource_item_id,
+ cpr.type as resource_type
+ from imsld_cp_resourcesi cpr, imsld_itemsi ii, imsld_attribute_instances attr,
+ acs_rels ar
+ where ar.object_id_one = ii.item_id
+ and ar.object_id_two = cpr.item_id
+ and content_revision__is_live(cpr.resource_id) = 't'
+ and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
+ and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
+ or ii.imsld_item_id = :imsld_item_id)
+ and attr.owner_id = ii.imsld_item_id
+ and attr.run_id = :run_id
+ and attr.type = 'isvisible'
+ and attr.is_visible_p = 't'
+
+
+
+
+
+
select structure_id,
structure_type
from imsld_activity_structuresi
where item_id = :structure_item_id
-
-
+
+
-
select ar.object_id_two,
ar.rel_type,
ar.rel_id
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 -N -r1.3 -r1.4
--- openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl 19 May 2006 17:26:02 -0000 1.3
+++ openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl 29 May 2006 15:10:52 -0000 1.4
@@ -229,8 +229,9 @@
-user_id
-run_id
} {
- Returns a list with all the roles_id from which the user are member. If imsld_id is given, restrict the list to the roles of the imsld.
+ Returns a list with all the roles_id from which the user are member. If run_id is given, restrict the list to the roles of the run.
} {
+ set roles_list [list]
if {[info exist run_id]} {
set roles_list [db_list get_user_roles_list {}]
} else {
Index: openacs-4/packages/imsld/www/admin/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/index.tcl,v
diff -u -N -r1.6 -r1.7
--- openacs-4/packages/imsld/www/admin/index.tcl 16 May 2006 09:24:36 -0000 1.6
+++ openacs-4/packages/imsld/www/admin/index.tcl 29 May 2006 15:10:53 -0000 1.7
@@ -104,8 +104,13 @@
label "[_ imsld.Run_IMS-LD_Name]"
orderby_asc {imsld_title asc}
orderby_desc {imsld_title desc}
- display_template {@imsld_runs.imsld_title@}
+ display_template {@imsld_runs.imsld_title@}
}
+ status {
+ label "[_ imsld.Status]"
+ orderby_asc {status asc}
+ orderby_desc {status desc}
+ }
creation_date {
label "[_ imsld.Creation_Date]"
orderby_asc {creation_date asc}