[join [lindex $activities_list 3] " "]"
+ if { ![llength [lindex $activities_list 3]] } {
+ set status "
"
+ } else {
+ set status ""
+ }
template::multirow append imsld_multirow $prerequisites \
$objectives \
$environments \
$activities \
{} \
- {}
- #"
"
+ $status
}
# support activity
if { [string eq $activity_type support] } {
- db_1row support_activity {
- select sa.activity_id,
- sa.item_id as activity_item_id,
- sa.title as activity_title,
- sa.identifier
- from imsld_support_activitiesi sa
- where sa.activity_id = :activity_id
- }
+ db_1row support_activity { *SQL* }
set activities_list [imsld::process_support_activity -activity_item_id $activity_item_id]
if { [llength [lindex $activities_list 0]] } {
@@ -2248,205 +2299,205 @@
regsub -all {
} $environments "" environments
}
- set activities "$activity_title
$activity_title
[join [lindex $activities_list 1] " "]"
+ if { ![llength [lindex $activities_list 1]] } {
+ set status "
finish"
+ } else {
+ set status ""
+ }
+
template::multirow append imsld_multirow {} \
{} \
$environments \
$activities \
{} \
- {}
- #"
finish"
+ $status
}
# first parameter: activity name
return [template::multirow size imsld_multirow]
}
-ad_proc -public imsld::get_activity_from_resource {
- -resource_id
+ad_proc -public imsld::get_activity_from_environment {
+ -environment_item_id
+
} {
- @return The a list of the activity_id, activity_item_id and activity_type from which the resource is being referenced
+ @return The a list of lists of the activity_id, activity_item_id and activity_type from which the environment is being referenced
} {
- #set a flag. while 1, keep trying
-
- # Case 1: check if it is referenced from a learning activity (trhough the activity_description)
- set activity_item_id ""
- if { [db_0or1row learning_activity_resource {
- select ila.activity_id,
- ila.item_id as activity_item_id
- from imsld_cp_resourcesi icri,
- acs_rels ar1,
- acs_rels ar2,
- imsld_learning_activitiesi ila
- where ar2.object_id_two=icri.item_id
- and ar1.object_id_two=ar2.object_id_one
- and ila.activity_description_id=ar1.object_id_one
- and icri.resource_id= :resource_id
- }] } {
- # found it, it's referenced from a learning activity
- return [list $activity_id $activity_item_id learning]
- }
-
- # Case 2: check if it is referenced from a support activity (trhough the activity_description)
- set activity_item_id ""
- if { [db_0or1row support_activity_resource {
- select isa.activity_id,
- isa.item_id as activity_item_id
- from imsld_cp_resourcesi icri,
- acs_rels ar1,
- acs_rels ar2,
- imsld_support_activitiesi isa
- where ar2.object_id_two=icri.item_id
- and ar1.object_id_two=ar2.object_id_one
- and isa.activity_description_id=ar1.object_id_one
- and icri.resource_id= :resource_id
- }] } {
- # found it, it's referenced from a support activity
- return [list $activity_id $activity_item_id support]
- }
-
- # Case 3: check if it is referenced from a service
-
- # first get the imsld_item_id
- db_1row get_imsld_item_id {
- select ar1.object_id_one as imsld_item_item_id
- from imsld_cp_resourcesi icri,
- acs_rels ar1
- where icri.item_id=ar1.object_id_two
- and icri.resource_id= :resource_id
- }
-
- # there are three options: a service, a conference service or a learning object
-
- # FIX ME: VALID ONLY FOR CONFERENCE_SERVICES!!!
- if { [db_0or1row is_conference_service {select 1 from imsld_conference_services where imsld_item_id=:imsld_item_item_id} ] } {
- # conference service
- # get the environment_id
- db_1row get_environment_id_from_cs {
- select isi.environment_id as environment_item_id
- from imsld_conference_services ics,
- imsld_servicesi isi
- where isi.item_id=ics.service_id
- and ics.imsld_item_id=:imsld_item_item_id
+ set activities_list [list]
+ foreach environment_list [db_list_of_lists get_env_info {
+ select ar.object_id_one,
+ ar.rel_type
+ from acs_rels ar
+ where ar.object_id_two = :environment_item_id
+ }] {
+ set object_id_one [lindex $environment_list 0]
+ set rel_type [lindex $environment_list 1]
+ # the enviroment may be referenced froma learning activity, support activity or from an enviroment!
+ if { [string eq $rel_type imsld_la_env_rel] } {
+ set activities_list [concat $activities_list [db_list_of_lists learning_env_ref {
+ select la.activity_id,
+ la.item_id,
+ 'learning'
+ from imsld_learning_activitiesi la
+ where la.item_id = :object_id_one
+ }]]
}
-
- # evironment referenced from learning activity ?
- if { [db_0or1row get_learning_activity_from_environment {
- select ila.activity_id,
- ila.item_id as activity_item_id
- from acs_rels ar,
- imsld_learning_activitiesi ila
- where ila.item_id=ar.object_id_one
- and ar.object_id_two=:environment_item_id
- }] } {
- return [list $activity_id $activity_item_id learning]
+ if { [string eq $rel_type imsld_sa_env_rel] } {
+ set activities_list [concat $activities_list [db_list_of_lists support_env_ref {
+ select sa.activity_id,
+ sa.item_id,
+ 'support'
+ from imsld_support_activitiesi sa
+ where sa.item_id = :object_id_one
+ }]]
}
-
- # evironment referenced from support activity ?
- if { [db_0or1row get_support_activity_from_environment {
- select isa.activity_id,
- isa.item_id as activity_item_id
- from acs_rels ar,
- imsld_support_activitiesi isa
- where isa.item_id=ar.object_id_one
- and ar.object_id_two=:environment_item_id
- }] } {
- return [list $activity_id $activity_item_id support]
+ if { [string eq $rel_type imsld_env_env_rel] } {
+ # the environment is referenced fron another environment.
+ # we get the referencer environment and call this function again (recursivity is our friend =)
+ # and besides, the environment may be referenced from more than one environment!
+ set activities_list_nested [list]
+ foreach referenced_environment [db_list_of_lists get_referencer_env_info {
+ select ar.object_id_one as env_referencer_id
+ from acs_rels ar
+ where ar.object_id_two = :object_id_one
+ }] {
+ set referencer_env_item_id [lindex $referenced_environment 0]
+ set activities_list_nested [concat $activities_list_nested [imsld::get_activity_from_environment -environment_item_id $referencer_env_item_id]]
+ }
+ set activities_list [concat $activities_list $$activities_list]
}
}
-
+ return $activities_list
+}
- # Case 4: learning objects
- if { [db_0or1row is_learning_object {
- select 1 from acs_rels where rel_type='imsld_l_object_item_rel' and object_id_two=:imsld_item_item_id
- } ] } {
- db_1row get_environment_id_from_lo {
- select iloi.environment_id as environment_item_id
- from imsld_learning_objectsi iloi,
- acs_rels ar
- where iloi.item_id=ar.object_id_one
- and ar.object_id_two=:imsld_item_item_id
- }
-
- # learning object referenced from a learning activity ?
- if { [db_0or1row get_learning_activity_from_environment {
- select ila.activity_id,
- ila.item_id as activity_item_id
- from acs_rels ar,
- imsld_learning_activitiesi ila
- where ila.item_id=ar.object_id_one
- and ar.object_id_two=:environment_item_id
- }] } {
- return [list $activity_id $activity_item_id learning]
- }
-
- # learning object referenced from a support activity ?
- if { [db_0or1row get_support_activity_from_environment {
- select isa.activity_id,
- isa.item_id as activity_item_id
- from acs_rels ar,
- imsld_support_activitiesi isa
- where isa.item_id=ar.object_id_one
- and ar.object_id_two=:environment_item_id
- }] } {
- return [list $activity_id $activity_item_id support]
- }
+ad_proc -public imsld::get_activity_from_resource {
+ -resource_id
+} {
+ @return The a list of lists of the activity_id, activity_item_id and activity_type from which the resource is being referenced
+} {
+ set activities_list [list]
+ # find out the rel_type in order to know from which activity the resource is being referenced
+ foreach object_list [db_list_of_lists directly_mapped_info {
+ select ar.rel_type,
+ ar.object_id_one
+ from acs_rels ar, imsld_cp_resourcesi icr
+ where icr.resource_id = :resource_id
+ and ar.object_id_two = icr.item_id
+ }] {
+ set rel_type [lindex $object_list 0]
+ set object_id_one [lindex $object_list 1]
+ if { [string eq $rel_type imsld_item_res_rel] } {
+ # get item info
+ foreach nested_object_list [db_list_of_lists get_nested_info {
+ select ar.rel_type as rel_type_nested,
+ ar.object_id_one as object_id_nested
+ from acs_rels ar
+ where ar.object_id_two = :object_id_one
+ }] {
+ set rel_type_nested [lindex $nested_object_list 0]
+ set object_id_nested [lindex $nested_object_list 1]
+ if { [string eq $rel_type_nested imsld_preq_item_rel] } {
+ # get the learning_activity_id and return it
+ set activities_list [concat $activities_list [db_list_of_lists get_prereq_activity {
+ select la.activity_id,
+ la.item_id as activity_item_id,
+ 'learning'
+ from imsld_learning_activitiesi la,
+ imsld_prerequisitesi prereq
+ where prereq.item_id = :object_id_nested
+ and la.prerequisite_id = prereq.item_id
+ }]]
+ }
+ if { [string eq $rel_type_nested imsld_lo_item_rel] } {
+ # get the learning_activity_id and return it
+ set activities_list [concat $activities_list [db_list_of_lists get_lobjective_activity {
+ select la.activity_id,
+ la.item_id as activity_item_id,
+ 'learning'
+ from imsld_learning_activitiesi la,
+ imsld_learning_objectivesi lobjectives
+ where lobjectives.item_id = :object_id_nested
+ and la.learning_objective_id = lobjectives.item_id
+ }]]
+ }
+ if { [string eq $rel_type_nested imsld_actdesc_item_rel] } {
+ # get the learning or support activity and return it
+ if { [db_0or1row learning_activity_ref {
+ select la.activity_id,
+ la.item_id as activity_item_id,
+ 'learning'
+ from imsld_learning_activitiesi la,
+ imsld_activity_descsi ades
+ where ades.item_id = :object_id_nested
+ and la.activity_description_id = ades.item_id
+ }] } {
+ set activities_list [concat $activities_list [list [list $activity_id $activity_item_id learning]]]
+ } else {
+ set activities_list [concat $activities_list [db_list_of_lists support_activity_ref {
+ select sa.activity_id,
+ sa.item_id as activity_item_id,
+ 'support'
+ from imsld_support_activitiesi sa,
+ imsld_activity_descsi ades
+ where ades.item_id = :object_id_nested
+ and sa.activity_description_id = ades.item_id
+ }]]
+ }
+ }
+ if { [string eq $rel_type_nested imsld_as_info_i_rel] } {
+ # get the activity_structure_id and return it
+ set activities_list [concat $activities_list [db_list_of_lists activity_structure_ref {
+ select as.structure_id as activity_id
+ as.item_id as activity_item_id,
+ 'structure'
+ from imsld_activity_structuresi as
+ where as.item_id = :object_id_nested
+ }]]
+ }
+ if { [string eq $rel_type_nested imsld_l_object_item_rel] } {
+ # item referenced from a learning object, which it's referenced fron an environment
+ # get the environment
+ db_1row get_env_lo_info {
+ select lo.environment_id as environment_item_id
+ from imsld_learning_objectsi lo
+ where lo.item_id = :object_id_nested
+ }
+ set activities_list [concat $activities_list [imsld::get_activity_from_environment -environment_item_id $environment_item_id]]
+ }
+ }
+ # if we reached this point, the resource may be reference fron a conference service
+ # which is referenced from an environment
+ if { [db_0or1row get_env_serv_info {
+ select serv.environment_id as environment_item_id
+ from imsld_conference_servicesi ecs,
+ imsld_servicesi serv
+ where ecs.item_id = :object_id_nested
+ and ecs.service_id = serv.item_id
+ }] } {
+ set activities_list [concat $activities_list [imsld::get_activity_from_environment -environment_item_id $environment_item_id]]
+ }
+ }
}
-
- # Case 5: the last one. it has to be referenced fron a learning objective or prerequisite,
- # which is referenced from a larning activity
-
- #get the element with which the resource is asociated (prerequisite,learning objective,environment or learning activity)
- db_1row get_activity_from_resource {
- select ar1.object_id_one as resource_element_id
- from acs_rels ar1,
- acs_rels ar2,
- imsld_cp_resourcesi icr
- where ar1.object_id_two=ar2.object_id_one
- and ar2.object_id_two=icr.item_id
- and icr.resource_id = :resource_id;
- }
-
- # prerequisite ?
- if { [db_0or1row is_prerequisite { select 1 from imsld_prerequisitesi where item_id=:resource_element_id }] } {
- db_1row get_activity_id_from_prerequisite {
- select activity_id,
- item_id as activity_item_id
- from imsld_learning_activitiesi
- where prerequisite_id=:resource_element_id
- }
- return [list $activity_id $activity_item_id learning]
- } elseif { [db_0or1row is_learning_objective { select 1 from imsld_learning_objectivesi where item_id=:resource_element_id } ] } {
- # learning objective?
- db_1row get_activity_id_from_objective {
- select activity_id,
- item_id as activity_item_id
- from imsld_learning_activitiesi
- where learning_objective_id=:resource_element_id
- }
- return [list $activity_id $activity_item_id support]
- }
- return -code error "IMSLD::imsld::get_activity_from_resource no activity_id found for resource"
+ return $activities_list
}
ad_proc -public imsld::get_imsld_from_activity {
-activity_id
+ -activity_type
} {
@return The imsld_id from which the activity is being used.
} {
- db_1row get_imsld_from_activity {
- select iii.imsld_id as imsld_id
- from imsld_imsldsi iii,
- cr_items cr,
- cr_items cr2,
- imsld_learning_activitiesi ilai
- where ilai.activity_id=:activity_id
- and ilai.item_id=cr.item_id
- and cr2.parent_id=cr.parent_id
- and cr2.content_type='imsld_imsld'
- and iii.item_id=cr2.item_id
-
+ switch $activity_type {
+ learning {
+ db_1row get_imsld_from_la_activity { *SQL* }
+ }
+ support {
+ db_1row get_imsld_from_sa_activity { *SQL* }
+ }
+ structure {
+ db_1row get_imsld_from_as_activity { *SQL* }
+ }
}
return $imsld_id
}
@@ -2474,57 +2525,74 @@
} {
-#look for the asociated activity
- # get the activity_id, activity_item_id and activity_type
- set activity_list [imsld::get_activity_from_resource -resource_id $resource_id]
- set activity_id [lindex $activity_list 0]
- set activity_item_id [lindex $activity_list 1]
- set activity_type [lindex $activity_list 2]
+ #look for the asociated activities
+ set activities_list [imsld::get_activity_from_resource -resource_id $resource_id]
+ # process each activity
+ foreach activity_list $activities_list {
+ if { !([llength $activity_list] == 3) } {
+ # it's not refrenced from an activity, skip it
+ break
+ }
+ # set the activity_id, activity_item_id and activity_type
+ set activity_id [lindex $activity_list 0]
+ set activity_item_id [lindex $activity_list 1]
+ set activity_type [lindex $activity_list 2]
+
+ #get info
+ set role_part_id_list [imsld::get_role_part_from_activity -activity_type $activity_type -leaf_id $activity_item_id]
+ set imsld_id [imsld::get_imsld_from_activity -activity_id $activity_id -activity_type $activity_type]
+ set user_id [ad_conn user_id]
+
+ #if not done yet, tag the resource as finished
+ if { ![db_string check_completed_resource { *SQL* }] } {
+ db_dml insert_completed_resource { *SQL* }
+ }
+ #find all the resouces in the same activity
+ switch $activity_type {
+ learning {
+ set first_resources_item_list [imsld::process_learning_activity -activity_item_id $activity_item_id -resource_mode "t"]
+ }
+ support {
+ set first_resources_item_list [imsld::process_support_activity -activity_item_id $activity_item_id -resource_mode "t"]
+ }
+ structure {
+ set first_resources_item_list [imsld::process_activity_structure -activity_item_id $activity_item_id -resource_mode "t"]
+ }
+ }
-
-#get info
- set role_part_id [imsld::get_role_part_from_activity -activity_type learning -leaf_id $activity_item_id]
- set imsld_id [imsld::get_imsld_from_activity -activity_id $activity_id]
- set user_id [ad_conn user_id]
-
-
-#if not done yet, tag the resource as finished
- if { ![db_string check_completed_resource { *SQL* }] } {
- db_dml insert_completed_resource { *SQL* }
- }
-#find all the resouces in the same activity
- set first_resources_item_list [imsld::process_learning_activity -activity_item_id $activity_item_id -resource_mode "t"]
-
-#only the learning_activities must be finished
- set resources_item_list [lindex $first_resources_item_list 3]
- if { [llength $resources_item_list] == 0 } {
- set resources_item_list [lindex $first_resources_item_list 2]
- }
+ #only the learning_activities must be finished
+ set resources_item_list [lindex $first_resources_item_list 3]
+ if { [llength $resources_item_list] == 0 } {
+ set resources_item_list [lindex $first_resources_item_list 2]
+ }
- set all_finished_p 1
- foreach resource_item_id $resources_item_list {
- foreach res_id $resource_item_id {
- if { ![db_0or1row resource_finished_p {
- select 1
- from imsld_status_user stat, imsld_cp_resourcesi icr
- where icr.item_id = :res_id
- and icr.resource_id = stat.completed_id
- and user_id = :user_id
- }] } {
- # if the resource is not in the imsld_status_user, then the resource is not finished
- set all_finished_p 0
- break
+ set all_finished_p 1
+ foreach resource_item_id $resources_item_list {
+ foreach res_id $resource_item_id {
+ if { ![db_0or1row resource_finished_p {
+ select 1
+ from imsld_status_user stat, imsld_cp_resourcesi icr
+ where icr.item_id = :res_id
+ and icr.resource_id = stat.completed_id
+ and user_id = :user_id
+ }] } {
+ # if the resource is not in the imsld_status_user, then the resource is not finished
+ set all_finished_p 0
+ break
+ }
}
}
- }
-#if all are finished, tag the activity as finished
- if { $all_finished_p && ![db_0or1row already_finished { *SQL* }] } {
- imsld::finish_component_element -imsld_id $imsld_id \
- -role_part_id $role_part_id \
- -element_id $activity_id \
- -type $activity_type\
- -code_call
+ #if all are finished, tag the activity as finished
+ if { $all_finished_p && ![db_0or1row already_finished { *SQL* }] } {
+ foreach role_part_id $role_part_id_list {
+ imsld::finish_component_element -imsld_id $imsld_id \
+ -role_part_id $role_part_id \
+ -element_id $activity_id \
+ -type $activity_type\
+ -code_call
+ }
+ }
}
}
Index: openacs-4/packages/imsld/tcl/imsld-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs.xql,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/imsld/tcl/imsld-procs.xql 9 Feb 2006 13:28:06 -0000 1.10
+++ openacs-4/packages/imsld/tcl/imsld-procs.xql 22 Feb 2006 16:09:39 -0000 1.11
@@ -680,11 +680,13 @@
- select sort_order, structure_id, item_id
+
+ select sort_order, structure_id, title,
+ item_id
from imsld_activity_structuresi
where item_id = :object_id_two
and content_revision__is_live(structure_id) = 't'
-
+
@@ -882,32 +884,34 @@
+
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
-
+
- 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'
+ 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
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)
-
+
@@ -988,14 +992,15 @@
- 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'
+ 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
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)
@@ -1055,14 +1060,15 @@
- 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'
+ 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
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)
@@ -1073,7 +1079,7 @@
- select coalesce(oc.feedback_title, oc.title) as feedback_title
+ select oc.feedback_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'
@@ -1097,14 +1103,15 @@
- 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'
+ 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
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)
@@ -1115,13 +1122,14 @@
- select identifier,
- type as resource_type,
- title as resource_title,
+ select cpr.identifier,
+ cpr.type as resource_type,
+ cr.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'
+ 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
@@ -1159,12 +1167,13 @@
select cpf.imsld_file_id,
cpf.file_name,
- cpf.item_id, cpf.parent_id
- from imsld_cp_filesx cpf,
+ cr.item_id,
+ cr.parent_id
+ from imsld_cp_files cpf, cr_items cr,
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'
+ and ar.object_id_two = cr.item_id
+ and cpf.imsld_file_id = cr.live_revision
@@ -1233,30 +1242,32 @@
select ii.imsld_item_id
- from imsld_items ii, imsld_activity_descs lad, imsld_learning_activitiesi la,
- cr_items cr1, cr_items cr2,
+ from imsld_items ii, imsld_activity_descs lad, imsld_learning_activities la,
+ cr_items cr1, cr_items cr2, cr_items cr3,
acs_rels ar
- where la.item_id = :activity_item_id
+ where cr3.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,
- 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'
+ 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
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)
@@ -1292,30 +1303,32 @@
select ii.imsld_item_id
- from imsld_items ii, imsld_activity_descs sad, imsld_support_activitiesi sa,
- cr_items cr1, cr_items cr2,
+ from imsld_items ii, imsld_activity_descs sad, imsld_support_activities sa,
+ cr_items cr1, cr_items cr2, cr_items cr3,
acs_rels ar
- where sa.item_id = :activity_item_id
+ where cr3.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,
- 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'
+ 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
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)
@@ -1374,15 +1387,15 @@
from imsld_status_user
where user_id = :user_id
and imsld_id = :imsld_id
- and status = 'finished'
- and type = 'role-part'
+ and type in ('learning','support','structure')
- select irp.role_part_id
+
+ select irp.role_part_id, ia.act_id, ip.play_id
from cr_items cr0, cr_items cr1, cr_items cr2, imsld_methods im, imsld_plays ip, imsld_acts ia, imsld_role_parts irp
where im.imsld_id = :imsld_item_id
and ip.method_id = cr0.item_id
@@ -1395,19 +1408,19 @@
and ip.sort_order = (select min(ip2.sort_order) from imsld_plays ip2 where ip2.method_id = cr0.item_id)
and ia.sort_order = (select min(ia2.sort_order) from imsld_acts ia2 where ia2.play_id = cr1.item_id)
and irp.sort_order = (select min(irp2.sort_order) from imsld_role_parts irp2 where irp2.act_id = cr2.item_id)
-
-
+
-
+
select stat.related_id,
stat.role_part_id,
stat.type,
rp.sort_order,
- rp.act_id
+ rp.act_id,
+ stat.status
from imsld_status_user stat, imsld_role_parts rp
where stat.imsld_id = :imsld_id
and stat.user_id = :user_id
@@ -1421,7 +1434,7 @@
- select coalesce(title,identifier) as activity_title,
+ select title as activity_title,
item_id as activity_item_id
from imsld_learning_activitiesi
where activity_id = :related_id
@@ -1432,7 +1445,7 @@
- select coalesce(title,identifier) as activity_title,
+ select title as activity_title,
item_id as activity_item_id
from imsld_support_activitiesi
where activity_id = :related_id
@@ -1443,7 +1456,7 @@
- select coalesce(title,identifier) as activity_title,
+ select title as activity_title,
item_id as structure_item_id
from imsld_activity_structuresi
where structure_id = :related_id
@@ -1555,7 +1568,7 @@
select la.activity_id,
la.item_id as activity_item_id,
la.title as activity_title,
- la.identifier
+ la.identifier, la.component_id
from imsld_learning_activitiesi la
where la.activity_id = :activity_id
@@ -1650,26 +1663,28 @@
-
+
- select ila.activity_id,
- ila.item_id as activity_item_id
- from acs_rels ar,
- imsld_learning_activitiesi ila
- where ila.item_id=ar.object_id_one
- and ar.object_id_two=:environment_item_id
-
+ select ila.activity_id,
+ ila.item_id as activity_item_id,
+ 'learning'
+ from acs_rels ar,
+ imsld_learning_activitiesi ila
+ where ila.item_id=ar.object_id_one
+ and ar.object_id_two=:environment_item_id
+
-
+
- select isa.activity_id,
- isa.item_id as activity_item_id
- from acs_rels ar,
- imsld_support_activitiesi isa
- where isa.item_id=ar.object_id_one
- and ar.object_id_two=:environment_item_id
+ select isa.activity_id,
+ isa.item_id as activity_item_id,
+ 'learning'
+ from acs_rels ar,
+ imsld_support_activitiesi isa
+ where isa.item_id=ar.object_id_one
+ and ar.object_id_two=:environment_item_id
@@ -1758,7 +1773,7 @@
-
+
select iii.imsld_id as imsld_id
from imsld_imsldsi iii,
@@ -1774,7 +1789,38 @@
+
+
+ select iii.imsld_id as imsld_id
+ from imsld_imsldsi iii,
+ cr_items cr,
+ cr_items cr2,
+ imsld_support_activitiesi isai
+ where isai.activity_id=:activity_id
+ and isai.item_id=cr.item_id
+ and cr2.parent_id=cr.parent_id
+ and cr2.content_type='imsld_imsld'
+ and iii.item_id=cr2.item_id
+
+
+
+
+
+ select iii.imsld_id as imsld_id
+ from imsld_imsldsi iii,
+ cr_items cr,
+ cr_items cr2,
+ imsld_activity_structuresi iasi
+ where iasi.structureid=:activity_id
+ and iasi.item_id=cr.item_id
+ and cr2.parent_id=cr.parent_id
+ and cr2.content_type='imsld_imsld'
+ and iii.item_id=cr2.item_id
+
+
+
+
select resource_id
@@ -1788,7 +1834,6 @@
insert into imsld_status_user (
imsld_id,
- role_part_id,
related_id,
user_id,
type,
@@ -1797,7 +1842,6 @@
)
(
select :imsld_id,
- :role_part_id,
:resource_id,
:user_id,
'resource',
Index: openacs-4/packages/imsld/www/imsld-finish-resource.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-finish-resource.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/imsld/www/imsld-finish-resource.tcl 2 Feb 2006 13:57:15 -0000 1.3
+++ openacs-4/packages/imsld/www/imsld-finish-resource.tcl 22 Feb 2006 16:09:39 -0000 1.4
@@ -6,51 +6,18 @@
resource_item_id
}
-db_1row get_resource_id {
- select resource_id
- from imsld_cp_resourcesi
- where item_id=:resource_item_id
+# fedback nor assessment has to be marked as finished
+if { [db_0or1row not_fedbk_nor_assmnt {
+ select icr.resource_id
+ from acs_rels ar,
+ imsld_cp_resourcesi icr
+ where ar.rel_type != 'imsld_feedback_rel'
+ and icr.item_id = ar.object_id_two
+ and ar.object_id_two = :resource_item_id
+ and icr.type != 'imsqti_xmlv1p0'
+ limit 1
+}] } {
+ imsld::finish_resource -resource_id $resource_id
}
-#feedback must not be finished
-if { ![
- db_0or1row is_feedback { select 1
- from acs_rels ar1,
- acs_rels ar2,
- imsld_feedback_rel_ext ifre
- where ifre.rel_id=ar1.rel_id and
- ar1.object_id_two=ar2.object_id_one and
- ar2.object_id_two=:resource_item_id
- } ] } {
-
-#assessment is finished by a callback when results are submited
- if {![db_string is_assessment {} ]} {
-
- set prerequisites_list [db_list get_all_prerequisites {
- select prerequisite_id
- from imsld_imslds
- }]
- set objectives_list [db_list get_all_objectives {
- select learning_objective_id
- from imsld_imslds
- }]
-
-#para no finalizar los prerequisitos y objetivos globales
- set identifier ""
- db_0or1row get_identifier_resource_id {
- select ar1.object_id_one as identifier
- from acs_rels ar1,
- acs_rels ar2
- where ar1.object_id_two=ar2.object_id_one
- and ar2.object_id_two=:resource_item_id;
- }
-
- if { [lsearch [concat $prerequisites_list $objectives_list] $identifier] != "-1" } {
-
- } else {
-
- imsld::finish_resource -resource_id $resource_id
- }
- }
-}
ad_returnredirect $file_url
Index: openacs-4/packages/imsld/www/imsld-finish-resource.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-finish-resource.xql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/imsld/www/imsld-finish-resource.xql 2 Feb 2006 13:57:15 -0000 1.2
+++ openacs-4/packages/imsld/www/imsld-finish-resource.xql 22 Feb 2006 16:09:39 -0000 1.3
@@ -58,9 +58,21 @@
from acs_rels ar1,
acs_rels ar2
where ar1.object_id_two=ar2.object_id_one
- and ar2.object_id_two=:resource_item_id;
+ and ar2.object_id_two=:resource_item_id
+
+
+
+
+ select count(ar1.object_id_one)
+ from acs_rels ar1,
+ acs_rels ar2
+ where ar1.object_id_two=ar2.object_id_one
+ and ar2.object_id_two=:resource_item_id
+
+
+
Index: openacs-4/packages/imsld/www/admin/imsld-new-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-new-2.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/imsld/www/admin/imsld-new-2.tcl 25 Nov 2005 12:11:36 -0000 1.6
+++ openacs-4/packages/imsld/www/admin/imsld-new-2.tcl 22 Feb 2006 16:09:39 -0000 1.7
@@ -28,7 +28,7 @@
-message_1 "[_ imsld.lt_Uploading_and_process]" \
-message_2 "[_ imsld.lt_We_will_continue_auto]"
-ns_write "Uploading new IMS Learning Design
"
+ns_write "[_ imsld.lt_h2Uploading_new_IMS_L] "
set community_id [dotlrn_community::get_community_id]
# Atempting to create the new IMS LD.
@@ -56,6 +56,7 @@
ns_sleep 5
}
+ns_write "
"
# jump to the front page
ad_progress_bar_end -url [dotlrn_community::get_community_url $community_id]