Index: openacs-4/packages/imsld/tcl/imsld-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs.tcl,v diff -u -r1.99 -r1.100 --- openacs-4/packages/imsld/tcl/imsld-procs.tcl 17 Apr 2008 17:18:16 -0000 1.99 +++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 18 Apr 2008 14:42:32 -0000 1.100 @@ -1693,13 +1693,19 @@ @return 0 if the user does not participate in the act. 1 otherwise } { set user_id [expr { [string eq "" $user_id] ? [ad_conn user_id] : $user_id }] - set involved_roles [db_list get_roles_in_act {select irolei.role_id - from imsld_role_parts ir, - imsld_actsi iai, - imsld_rolesi irolei - where iai.act_id=:act_id - and iai.item_id=ir.act_id - and ir.role_id=irolei.item_id}] + set involved_roles [db_list get_roles_in_act { + select ir.role_id + from imsld_role_parts irp, + imsld_acts ia, + cr_items ca, + imsld_roles ir, + cr_items cr + where ia.act_id = :act_id + and ia.act_id = ca.live_revision + and ca.item_id = irp.act_id + and irp.role_id = cr.item_id + and cr.live_revision = ir.role_id + }] set involved_users [list] foreach role $involved_roles { set involved_users [concat $involved_users [imsld::roles::get_users_in_role -role_id $role -run_id $run_id ]] @@ -2900,14 +2906,6 @@ $img_node setAttribute alt "[_ imsld.finished]" $img_node setAttribute title "[_ imsld.finished]" $activity_node appendChild $img_node - } else { - # the activity has been viewed - set img_node [$dom_doc createElement img] - $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" - $img_node setAttribute border "0" - $img_node setAttribute alt "[_ imsld.Viewed]" - $img_node setAttribute title "[_ imsld.Viewed]" - $activity_node appendChild $img_node } } else { @@ -2921,14 +2919,6 @@ set text [$dom_doc createTextNode "[_ imsld.finish]"] $input_node appendChild $text $activity_node appendChild $input_node - } elseif { $started_activity_p } { - # the activity has been viewed - set img_node [$dom_doc createElement img] - $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" - $img_node setAttribute border "0" - $img_node setAttribute alt "[_ imsld.Viewed]" - $img_node setAttribute title "[_ imsld.Viewed]" - $activity_node appendChild $img_node } } set completed_list [linsert $completed_list $sort_order [$activity_node asList]] @@ -2997,14 +2987,6 @@ $img_node setAttribute alt "[_ imsld.finished]" $img_node setAttribute title "[_ imsld.finished]" $activity_node appendChild $img_node - } else { - # the activity has been viewed - set img_node [$dom_doc createElement img] - $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" - $img_node setAttribute border "0" - $img_node setAttribute alt "[_ imsld.Viewed]" - $img_node setAttribute title "[_ imsld.Viewed]" - $activity_node appendChild $img_node } } else { if { [string eq $user_choice_p "t"] } { @@ -3017,14 +2999,6 @@ set text [$dom_doc createTextNode "[_ imsld.finish]"] $input_node appendChild $text $activity_node appendChild $input_node - } elseif { $started_activity_p } { - # the activity has been viewed - set img_node [$dom_doc createElement img] - $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" - $img_node setAttribute border "0" - $img_node setAttribute alt "[_ imsld.Viewed]" - $img_node setAttribute title "[_ imsld.Viewed]" - $activity_node appendChild $img_node } } set completed_list [linsert $completed_list $sort_order [$activity_node asList]] @@ -3193,14 +3167,6 @@ $img_node setAttribute alt "[_ imsld.finished]" $img_node setAttribute title "[_ imsld.finished]" $activity_node appendChild $img_node - } else { - # the activity has been viewed - set img_node [$dom_doc createElement img] - $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" - $img_node setAttribute border "0" - $img_node setAttribute alt "[_ imsld.Viewed]" - $img_node setAttribute title "[_ imsld.Viewed]" - $activity_node appendChild $img_node } } elseif { [string eq $is_visible_p "t"] } { @@ -3214,14 +3180,6 @@ set text [$dom_doc createTextNode "[_ imsld.finish]"] $input_node appendChild $text $activity_node appendChild $input_node - } elseif { $started_activity_p } { - # the activity has been viewed - set img_node [$dom_doc createElement img] - $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" - $img_node setAttribute border "0" - $img_node setAttribute alt "[_ imsld.Viewed]" - $img_node setAttribute title "[_ imsld.Viewed]" - $activity_node appendChild $img_node } } @@ -3286,14 +3244,6 @@ $img_node setAttribute alt "[_ imsld.finished]" $img_node setAttribute title "[_ imsld.finished]" $activity_node appendChild $img_node - } else { - # the activity has been viewed - set img_node [$dom_doc createElement img] - $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" - $img_node setAttribute border "0" - $img_node setAttribute alt "[_ imsld.Viewed]" - $img_node setAttribute title "[_ imsld.Viewed]" - $activity_node appendChild $img_node } } else { if { [string eq $user_choice_p "t"] } { @@ -3305,14 +3255,6 @@ set text [$dom_doc createTextNode "[_ imsld.finish]"] $input_node appendChild $text $activity_node appendChild $input_node - } elseif { $started_activity_p } { - # the activity has been viewed - set img_node [$dom_doc createElement img] - $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" - $img_node setAttribute border "0" - $img_node setAttribute alt "[_ imsld.Viewed]" - $img_node setAttribute title "[_ imsld.Viewed]" - $activity_node appendChild $img_node } } $dom_node appendChild $activity_node @@ -3466,14 +3408,6 @@ $img_node setAttribute title "[_ imsld.finished]" $activity_node appendChild $img_node - } else { - # the activity has been viewed - set img_node [$dom_doc createElement img] - $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" - $img_node setAttribute border "0" - $img_node setAttribute alt "[_ imsld.Viewed]" - $img_node setAttribute title "[_ imsld.Viewed]" - $activity_node appendChild $img_node } } else { @@ -3488,15 +3422,6 @@ $input_node appendChild $text $b_node appendChild $input_node - } elseif { $started_activity_p } { - - # the activity has been viewed - set img_node [$dom_doc createElement img] - $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" - $img_node setAttribute border "0" - $img_node setAttribute alt "[_ imsld.Viewed]" - $img_node setAttribute title "[_ imsld.Viewed]" - $activity_node appendChild $img_node } } $dom_node appendChild $activity_node @@ -3553,14 +3478,6 @@ $img_node setAttribute title "[_ imsld.finished]" $activity_node appendChild $img_node - } else { - # the activity has been viewed - set img_node [$dom_doc createElement img] - $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" - $img_node setAttribute border "0" - $img_node setAttribute alt "[_ imsld.Viewed]" - $img_node setAttribute title "[_ imsld.Viewed]" - $activity_node appendChild $img_node } } else { if { [string eq $user_choice_p "t"] } { @@ -3576,15 +3493,6 @@ $b_node appendChild $input_node $activity_node appendChild $b_node - } elseif { $started_activity_p } { - - # the activity has been viewed - set img_node [$dom_doc createElement img] - $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" - $img_node setAttribute border "0" - $img_node setAttribute alt "[_ imsld.Viewed]" - $img_node setAttribute title "[_ imsld.Viewed]" - $activity_node appendChild $img_node } } $dom_node appendChild $activity_node @@ -3662,18 +3570,24 @@ set active_acts_list [list] set all_acts_list [db_list get_acts_in_run { - select iai.act_id + select ia.act_id from imsld_runs ir, - imsld_imsldsi iii, - imsld_methodsi imi, - imsld_playsi ipi, - imsld_actsi iai - where ir.run_id=:run_id - and iii.imsld_id=ir.imsld_id - and imi.imsld_id=iii.item_id - and imi.item_id=ipi.method_id - and iai.play_id=ipi.item_id - order by ipi.sort_order, iai.sort_order + imsld_imslds ii, + cr_items ci, + imsld_methods im, + cr_items cm, + imsld_plays ip, + cr_items cp, + imsld_acts ia + where ir.run_id = :run_id + and ii.imsld_id = ir.imsld_id + and ii.imsld_id = ci.live_revision + and ci.item_id = im.imsld_id + and im.method_id = cm.live_revision + and cm.item_id = ip.method_id + and ip.play_id = cp.live_revision + and cp.item_id = ia.play_id + order by ip.sort_order, ia.sort_order }] set i 0 set continue 1 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.38 -r1.39 --- openacs-4/packages/imsld/tcl/imsld-procs.xql 17 Apr 2008 17:18:16 -0000 1.38 +++ openacs-4/packages/imsld/tcl/imsld-procs.xql 18 Apr 2008 14:42:32 -0000 1.39 @@ -1166,14 +1166,16 @@ - select cpr.resource_id, - cpr.item_id as resource_item_id, - cpr.type as resource_type - from imsld_cp_resourcesi cpr, imsld_itemsi ii, + select icr.resource_id, + cr.item_id as resource_item_id, + icr.type as resource_type + from imsld_cp_resources icr, imsld_items ii, cr_items ci, cr_items cr, 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' + where ar.object_id_one = ci.item_id + and ci.live_revision = ii.imsld_item_id + and ar.object_id_two = cr.item_id + and cr.live_revision = icr.resource_id + and content_revision__is_live(icr.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) @@ -1598,20 +1600,24 @@ - select la.on_completion_id as on_completion_item_id, - la.prerequisite_id as prerequisite_item_id, - la.learning_objective_id as learning_objective_item_id, - la.activity_id, - la.title as activity_title - from imsld_attribute_instances attr, - imsld_learning_activitiesi la - where la.item_id = :activity_item_id - and content_revision__is_live(la.activity_id) = 't' - and attr.owner_id = la.activity_id - and attr.run_id = :run_id - and attr.user_id = :user_id - and attr.type = 'isvisible' - and attr.is_visible_p = 't' + select la.on_completion_id as on_completion_item_id, + la.prerequisite_id as prerequisite_item_id, + la.learning_objective_id as learning_objective_item_id, + la.activity_id, + rla.title as activity_title + from imsld_attribute_instances attr, + imsld_learning_activities la, + cr_items cla, + cr_revisions rla + where cla.item_id = :activity_item_id + and cla.live_revision = la.activity_id + and cla.live_revision = rla.revision_id + and content_revision__is_live(la.activity_id) = 't' + and attr.owner_id = la.activity_id + and attr.run_id = :run_id + and attr.user_id = :user_id + and attr.type = 'isvisible' + and attr.is_visible_p = 't' @@ -1637,22 +1643,24 @@ - 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.user_id = :user_id - and attr.type = 'isvisible' - and attr.is_visible_p = 't' + select icr.resource_id, + cp.item_id as resource_item_id, + icr.type as resource_type + from imsld_cp_resources icr, imsld_items ii, imsld_attribute_instances iai, cr_items ci, cr_items cp, + acs_rels ar + where ii.imsld_item_id = ci.live_revision + and ar.object_id_one = ci.item_id + and icr.resource_id = cp.live_revision + and ar.object_id_two = cp.item_id + and content_revision__is_live(icr.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 iai.owner_id = ii.imsld_item_id + and iai.run_id = :run_id + and iai.user_id = :user_id + and iai.type = 'isvisible' + and iai.is_visible_p = 't' @@ -1844,20 +1852,21 @@ - select la.title as activity_title, - la.item_id as activity_item_id, - la.activity_id, - la.complete_act_id, - attr.is_visible_p - from imsld_learning_activitiesi la, imsld_attribute_instances attr - where la.item_id = :object_id_two - and content_revision__is_live(la.activity_id) = 't' - and attr.owner_id = la.activity_id - and attr.run_id = :run_id - and attr.user_id = :user_id - and attr.type = 'isvisible' + select cr.title as activity_title, + ci.item_id as activity_item_id, + la.activity_id, + la.complete_act_id, + attr.is_visible_p + from imsld_learning_activities la, imsld_attribute_instances attr, cr_items ci, cr_revisions cr + where ci.item_id = :object_id_two + and ci.live_revision = cr.revision_id + and ci.live_revision = la.activity_id + and content_revision__is_live(la.activity_id) = 't' + and attr.owner_id = la.activity_id + and attr.run_id = :run_id + and attr.user_id = :user_id + and attr.type = 'isvisible' - @@ -1948,36 +1957,41 @@ - select case - when rp.learning_activity_id is not null - then 'learning' - when rp.support_activity_id is not null - then 'support' - when rp.activity_structure_id is not null - then 'structure' - else 'none' - end as type, - content_item__get_live_revision(coalesce(rp.learning_activity_id,rp.support_activity_id,rp.activity_structure_id)) as activity_id, - rp.role_part_id, - ia.act_id, - ia.item_id as act_item_id, - ip.play_id - from imsld_role_partsi rp, imsld_actsi ia, imsld_playsi ip, imsld_imsldsi ii, imsld_attribute_instances attr, - imsld_methodsi im,imsld_rolesi iri - where rp.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.imsld_id = :imsld_id - and rp.role_id = iri.item_id - and iri.role_id = :user_role_id - and content_revision__is_live(rp.role_part_id) = 't' - and attr.owner_id = ip.play_id - and attr.run_id = :run_id - and attr.user_id = :user_id - and attr.type = 'isvisible' - and attr.is_visible_p = 't' - order by ip.sort_order, ia.sort_order, rp.sort_order + select case + when irp.learning_activity_id is not null + then 'learning' + when irp.support_activity_id is not null + then 'support' + when irp.activity_structure_id is not null + then 'structure' + else 'none' + end as type, + content_item__get_live_revision(coalesce(irp.learning_activity_id, irp.support_activity_id, irp.activity_structure_id)) as activity_id, + irp.role_part_id, + ia.act_id, + ca.item_id as act_item_id, + ip.play_id + from imsld_role_parts irp, imsld_acts ia, imsld_plays ip, imsld_imslds ii, imsld_attribute_instances iai, + imsld_methods im, imsld_roles ir, cr_items ca, cr_items cp, cr_items cm, cr_items ci, cr_items cr + where irp.act_id = ca.item_id + and ca.live_revision = ia.act_id + and ia.play_id = cp.item_id + and cp.live_revision = ip.play_id + and ip.method_id = cm.item_id + and cm.live_revision = im.method_id + and im.imsld_id = ci.item_id + and ci.live_revision = ii.imsld_id + and ii.imsld_id = :imsld_id + and irp.role_id = cr.item_id + and cr.live_revision = ir.role_id + and ir.role_id = :user_role_id + and content_revision__is_live(irp.role_part_id) = 't' + and iai.owner_id = ip.play_id + and iai.run_id = :run_id + and iai.user_id = :user_id + and iai.type = 'isvisible' + and iai.is_visible_p = 't' + order by ip.sort_order, ia.sort_order, irp.sort_order Index: openacs-4/packages/imsld/tcl/imsld-roles-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-roles-procs.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/imsld/tcl/imsld-roles-procs.xql 26 Sep 2006 09:42:24 -0000 1.5 +++ openacs-4/packages/imsld/tcl/imsld-roles-procs.xql 18 Apr 2008 14:42:32 -0000 1.6 @@ -189,24 +189,27 @@ - select iri.role_id - from imsld_rolesi iri, - group_member_map gmm, - acs_objects ao, - acs_rels ar, - acs_rels ar2 , - imsld_run_users_group_ext iruge - where ao.object_id=gmm.group_id - and ao.object_type='imsld_role_group' - and ar.object_id_one=gmm.group_id - and ar.rel_type='imsld_roleinstance_run_rel' - and gmm.member_id=:user_id - and iruge.group_id=ar.object_id_two - and iruge.run_id=:run_id - and gmm.container_id = gmm.group_id - and ar2.object_id_two=gmm.group_id - and ar2.rel_type='imsld_role_group_rel' - and ar2.object_id_one=iri.item_id + + select ir.role_id + from imsld_roles ir, + group_member_map gmm, + acs_objects ao, + acs_rels ar, + acs_rels ar2 , + imsld_run_users_group_ext iruge, + cr_items cr + where ao.object_id=gmm.group_id + and ao.object_type='imsld_role_group' + and ar.object_id_one=gmm.group_id + and ar.rel_type='imsld_roleinstance_run_rel' + and gmm.member_id=:user_id + and iruge.group_id=ar.object_id_two + and iruge.run_id=:run_id + and gmm.container_id = gmm.group_id + and ar2.object_id_two=gmm.group_id + and ar2.rel_type='imsld_role_group_rel' + and ar2.object_id_one=cr.item_id + and cr.live_revision=ir.role_id