Index: openacs-4/packages/imsld/lib/activity-resource.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/activity-resource.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/activity-resource.adp 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,62 @@ + + + + +
  • + + + @files.title@ + + @files.title@ + + + + + + +
  • +
    +
    +
    + + + +
  • + + + @files.file_name@ + + @files.file_name@ + + + + + + +
  • +
    +
    +
    + + + +
  • + + + @object_title@ + + @object_title@ + + + + + + +
  • +
    +
    +
    +
    Index: openacs-4/packages/imsld/lib/activity-resource.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/activity-resource.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/activity-resource.tcl 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,121 @@ +if {![info exists user_id]} { + set user_id [ad_conn user_id] +} + +if {![info exists community_id]} { + set community_id [dotlrn_community::get_community_id] +} + +set imsld_package_id [site_node_apm_integration::get_child_package_id \ + -package_id [dotlrn_community::get_package_id $community_id] \ + -package_key "[imsld::package_key]"] + +# 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] +db_1row get_resource_info { *SQL* } + +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 { *SQL* }] } { + db_1row get_cr_info { *SQL* } + } else { + 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]] + + set href [export_vars -base "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]imsld-finish-resource" {file_url $file_url resource_item_id $resource_item_id run_id $run_id}] + set img_src [imsld::object_type_image_path -object_type $object_type] + +} elseif { [string eq $resource_type "imsldcontent"] } { + + db_1row get_imsld { + select i.imsld_id, i.resource_handler + from imsld_runs r, imsld_imslds i + where r.run_id = :run_id + and r.imsld_id = i.imsld_id + } + + set associated_files_query "associated_files" + if { $resource_handler eq "xowiki" } { + set associated_files_query "associated_xo_files" + } + + multirow create files href file_name + + set img_src "[imsld::object_type_image_path -object_type file-storage]" + foreach file_list [db_list_of_lists $associated_files_query { *SQL* }] { + if { $resource_handler eq "xowiki" } { + set page_id [lindex $file_list 0] + set file_name [lindex $file_list 1] + set fs_file_url [export_vars -base [imsld::xowiki::page_url -item_id $page_id] {{template_file "/packages/imsld/lib/wiki-default"}}] + } else { + 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 { *SQL* }] + db_0or1row get_fs_file_url { *SQL* } + set fs_file_url $file_url + } + + set file_url "imsld-content-serve" + set 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}]" + + multirow append files $href $file_name + + } + +} else { + # is webcontent, let's get the associated files + + db_1row get_imsld { + select i.imsld_id, i.resource_handler + from imsld_runs r, imsld_imslds i + where r.run_id = :run_id + and r.imsld_id = i.imsld_id + } + + set associated_files_query "associated_files" + if { $resource_handler eq "xowiki" } { + set associated_files_query "associated_xo_files" + } + + multirow create files href title img_src + + foreach file_list [db_list_of_lists $associated_files_query { *SQL* }] { + if { $resource_handler eq "xowiki" } { + set page_id [lindex $file_list 0] + set file_name [lindex $file_list 1] + set file_url [export_vars -base [imsld::xowiki::page_url -item_id $page_id] {{template_file "/packages/imsld/lib/wiki-default"}}] + } else { + 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 { *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 href "[export_vars -base "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]imsld-finish-resource" {file_url $file_url resource_item_id $resource_item_id run_id $run_id}]" + set img_src "[imsld::object_type_image_path -object_type file-storage]" + + multirow append files $href $file_name $img_src + + } + # get associated urls + + db_foreach associated_urls { *SQL* } { + set 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}]" + set img_src "[imsld::object_type_image_path -object_type url]" + + multirow append files $href $url $img_src + } +} Index: openacs-4/packages/imsld/lib/activity-resource.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/activity-resource.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/activity-resource.xql 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + select identifier, + resource_id, + 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' + + + + + + + + select live_revision from cr_items where item_id = :acs_object_id + + + + + + + + + select acs_object__name(object_id) as object_title, object_type + from acs_objects where object_id = :live_revision + + + + + + + + + select acs_object__name(object_id) as object_title, object_type + from acs_objects where object_id = :acs_object_id + + + + + + + + + select cr.revision_id as imsld_file_id, + cpf.file_name, + cpf.item_id, + cpf.parent_id + from imsld_cp_filesx cpf, + acs_rels ar, imsld_res_files_rels map, + cr_revisions cr + where ar.object_id_one = :resource_item_id + and ar.object_id_two = cpf.item_id + and cpf.item_id = cr.item_id + and ar.rel_id = map.rel_id + and content_revision__is_live(cr.revision_id) = 't' + and map.displayable_p = 't' + + + + + + + + + select ci.item_id as page_id, ci.name as file_name + from acs_rels ar, imsld_res_files_rels map, + cr_revisions cr, cr_items ci + where ar.object_id_one = :resource_item_id + and ar.object_id_two = cr.item_id + and cr.item_id = ci.item_id + and ar.rel_id = map.rel_id + and content_revision__is_live(cr.revision_id) = 't' + and map.displayable_p = 't' + + + + + + + + select content_item__get_path(:parent_id,:root_folder_id); + + + + + + + + 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 + + + + + + + + + select url + from acs_rels ar, + 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' + + + + + Index: openacs-4/packages/imsld/lib/activity-resources-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/activity-resources-list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/activity-resources-list.adp 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,11 @@ + + + Index: openacs-4/packages/imsld/lib/activity-resources-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/activity-resources-list.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/activity-resources-list.tcl 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,37 @@ +set dom_doc [dom createDocument root] +set monitor_p 0 + +set linear_item_list [db_list item_linear_list { *SQL* }] +set has_items 0 + +multirow create resources resource_item_id + +foreach imsld_item_id $linear_item_list { + foreach sa_items_list [db_list_of_lists la_nested_associated_items { *SQL* }] { + set has_items 1 + 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] + + multirow append resources $resource_item_id + +# temporal commented: +# imsld::process_resource_as_ul -resource_item_id $resource_item_id \ +# -run_id $run_id \ +# -dom_doc $dom_doc \ +# -dom_node $list_node \ +# -li_mode \ +# -monitor=$monitor_p + + } +} + +if { $monitor_p } { + set li_node [$dom_doc createElement li] + set choose_node [$dom_doc createElement a] + $choose_node appendChild [$dom_doc createTextNode "Add"] + $choose_node setAttribute href {\#} + $li_node appendChild [$dom_doc createTextNode {[}] + $li_node appendChild $choose_node + $li_node appendChild [$dom_doc createTextNode {]}] +} Index: openacs-4/packages/imsld/lib/activity-resources-list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/activity-resources-list.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/activity-resources-list.xql 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,53 @@ + + + + + + + + + + + + + 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 + + + + + + + + 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' + + + + + Index: openacs-4/packages/imsld/lib/activity-tree.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/activity-tree.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/activity-tree.adp 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,15 @@ + + Index: openacs-4/packages/imsld/lib/activity-tree.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/activity-tree.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/activity-tree.tcl 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,38 @@ + +multirow create activities activity_id type play_id act_id role_part_id + +db_1row imslds_in_class { + select imsld.item_id as imsld_item_id, + imsld.imsld_id, + coalesce(imsld.title, imsld.identifier) as imsld_title + from imsld_imsldsi imsld, imsld_runs run + where imsld.imsld_id = run.imsld_id + and run.run_id = :run_id +} + +# start with the role parts +set imsld_package_id [ad_conn package_id] + +set user_role_id [db_string current_role { + select map.active_role_id as user_role_id + from imsld_run_users_group_rels map, + acs_rels ar, + imsld_run_users_group_ext iruge + where ar.rel_id = map.rel_id + and ar.object_id_one = iruge.group_id + and ar.object_id_two = :user_id + and iruge.run_id = :run_id +}] +set active_acts_list [imsld::active_acts -run_id $run_id -user_id $user_id] + +# get the referenced role parts +foreach role_part_list [db_list_of_lists referenced_role_parts { *SQL* }] { + set type [lindex $role_part_list 0] + set activity_id [lindex $role_part_list 1] + set role_part_id [lindex $role_part_list 2] + set act_id [lindex $role_part_list 3] + set act_item_id [lindex $role_part_list 4] + set play_id [lindex $role_part_list 5] + + multirow append activities $activity_id $type $play_id $act_id $role_part_id +} Index: openacs-4/packages/imsld/lib/activity-tree.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/activity-tree.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/activity-tree.xql 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + select map.active_role_id as user_role_id + from imsld_run_users_group_rels map, + acs_rels ar, + imsld_run_users_group_ext iruge + where ar.rel_id = map.rel_id + and ar.object_id_one = iruge.group_id + and ar.object_id_two = :user_id + and iruge.run_id = :run_id + + + + + + + + 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' + and content_item__get_live_revision(coalesce(irp.learning_activity_id,irp.support_activity_id,irp.activity_structure_id)) + is not null + order by ip.sort_order, ia.sort_order, irp.sort_order + + + + + + + + select sa.title as activity_title, + sa.item_id as activity_item_id, + sa.activity_id, + attr.is_visible_p, + sa.complete_act_id + from imsld_support_activitiesi sa, imsld_attribute_instances attr + where sa.activity_id = :activity_id + and attr.owner_id = sa.activity_id + and attr.run_id = :run_id + and attr.user_id = :user_id + and attr.type = 'isvisible' + + + + + + + + select title as activity_title, + item_id as structure_item_id, + structure_id, + structure_type + from imsld_activity_structuresi + where structure_id = :activity_id + + + + + + + + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and status = 'started' + and run_id = :run_id + + + + + + + + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and status = 'finished' + and run_id = :run_id + + + + + Index: openacs-4/packages/imsld/lib/activity.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/activity.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/activity.adp 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,72 @@ + + +
  • + + @activity_title@ + + + + #imsld.completed# + + + + + #imsld.finish# + + + +
  • +
    + + +
  • + + @activity_title@ + + + + #imsld.completed# + + + + + #imsld.finish# + + + +
  • +
    + + + +
  • + + @activity_title@ + + +
      + + + +
    +
    +
  • +
    +
    + +
    Index: openacs-4/packages/imsld/lib/activity.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/activity.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/activity.tcl 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,161 @@ +set active_acts_list [imsld::active_acts -run_id $run_id -user_id $user_id] +set act_item_id [content::revision::item_id -revision_id $act_id] + +set structure_type "" +set completion_restriction 1 +if {[info exists structure_item_id]} { + # if the activity is in a structure, get the structure's info + db_1row structure_info { *SQL* } + set completion_restriction [imsld::structure_completion_resctriction_p -run_id $run_id -structure_item_id $structure_item_id] + +} + +switch $type { + learning { + # add the learning activity to the tree + + db_1row get_learning_activity_info { *SQL* } + set started_activity_p [db_0or1row already_started { + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'started' + }] + set completed_activity_p [db_0or1row already_completed { + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'finished' + }] + + set user_choice_p [db_string user_choice_p { + select user_choice_p + from imsld_complete_actsi + where item_id = :complete_act_id + and content_revision__is_live(complete_act_id) = 't' + } -default "f"] + + if { $completed_activity_p + || ($structure_type eq "selection") + || (!$completion_restriction) + || ([lsearch -exact $next_activity_id_list $activity_id] != -1) + || ([string eq $complete_act_id ""] && [string eq $is_visible_p "t"] + && [lsearch -exact $active_acts_list $act_item_id] != -1) } { + + if { !$started_activity_p && [string eq $is_visible_p "t"] } { + # bold letters + set href [imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id] + set div [imsld::activity_url -div -activity_id $activity_id -run_id $run_id -user_id $user_id] + + set class "liOpen has_focus" + + } else { + # the activity has been started + set href [imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id] + set div [imsld::activity_url -div -activity_id $activity_id -run_id $run_id -user_id $user_id] + + set class "liOpen" + + } + + set finish_href "finish-component-element-${imsld_id}-${run_id}-${play_id}-${act_id}-${role_part_id}-${activity_id}-learning.imsld" + + } + } + support { + # add the support activity to the tree + db_1row get_support_activity_info { *SQL* } + set started_activity_p [db_0or1row already_started { + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'started' + }] + set completed_activity_p [db_0or1row already_completed { + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'finished' + }] + + set user_choice_p [db_string user_choice_p {select user_choice_p from imsld_complete_actsi where item_id = :complete_act_id and content_revision__is_live(complete_act_id) = 't'} -default "f"] + + if { $completed_activity_p + || ($structure_type eq "selection") + || (!$completion_restriction) + || ([lsearch -exact $next_activity_id_list $activity_id] != -1) + || ([string eq $complete_act_id ""] && [string eq $is_visible_p "t"] + && [lsearch -exact $active_acts_list $act_item_id] != -1) } { + + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + if { !$started_activity_p && [string eq $is_visible_p "t"] } { + # bold letters + set href [imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id] + set div [imsld::activity_url -div -activity_id $activity_id -run_id $run_id -user_id $user_id] + + set class "liOpen has_focus" + } else { + set href [imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id] + set div [imsld::activity_url -div -activity_id $activity_id -run_id $run_id -user_id $user_id] + + set class "liOpen" + } + + set finish_href "finish-component-element-${imsld_id}-${run_id}-${play_id}-${act_id}-${role_part_id}-${activity_id}-support.imsld" + + } + } + structure { + # this is a special case since there are some conditions to check + # in order to determine if the referenced activities have to be shown. + # because of that the proc generate_structure_activities_list is called, + # which returns a tcl list in tDOM format. + + # anyway, we add the structure to the tree only if: + # 1. the structure has already been started or finished + # 2. the referencer structure-type is "selection" + # (if it is the next activity to be done then it should had been marked as started + # in the "structure_next_activity" function. which is the case when structure-type is "sequence") + db_1row get_activity_structure_info { *SQL* } + set started_p [db_0or1row as_started_p { *SQL* }] + set completed_p [db_0or1row as_completed_p { *SQL* }] + if { $started_p } { + if { $completed_p } { + set href [imsld::activity_url -activity_id $structure_id -run_id $run_id -user_id $user_id] + set div [imsld::activity_url -div -activity_id $activity_id -run_id $run_id -user_id $user_id] + + set class "liOpen" + } else { + set href [imsld::activity_url -activity_id $structure_id -run_id $run_id -user_id $user_id] + set div [imsld::activity_url -div -activity_id $activity_id -run_id $run_id -user_id $user_id] + + set class "liOpen has_focus" + } + +# set activity_item_id [content::revision::item_id -revision_id $activity_id] + + db_multirow -extend {activity_id} referenced_activities struct_referenced_activities { *SQL* } { + set activity_id [content::item::get_live_revision -item_id $object_id_two] + } + +# set nested_list [imsld::generate_structure_activities_list -imsld_id $imsld_id \ +# -run_id $run_id \ +# -structure_item_id $structure_item_id \ +# -user_id $user_id \ +# -next_activity_id_list $next_activity_id_list \ +# -role_part_id $role_part_id \ +# -play_id $play_id \ +# -act_id $act_id \ +# -dom_doc $dom_doc \ +# -dom_node $dom_node] +# # the nested finished activities are returned as a tcl list in tDOM format +# $structure_node appendFromList [list ul [list] [concat [list] $nested_list]] +# $dom_node appendChild $structure_node + } + } +} Index: openacs-4/packages/imsld/lib/activity.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/activity.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/activity.xql 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + select la.title as activity_title, + la.item_id as activity_item_id, + la.activity_id, + attr.is_visible_p, + la.complete_act_id + from imsld_learning_activitiesi la, imsld_attribute_instances attr + where activity_id = :activity_id + and attr.owner_id = la.activity_id + and attr.run_id = :run_id + and attr.user_id = :user_id + and attr.type = 'isvisible' + + + + + + + + select sa.title as activity_title, + sa.item_id as activity_item_id, + sa.activity_id, + attr.is_visible_p, + sa.complete_act_id + from imsld_support_activitiesi sa, imsld_attribute_instances attr + where sa.activity_id = :activity_id + and attr.owner_id = sa.activity_id + and attr.run_id = :run_id + and attr.user_id = :user_id + and attr.type = 'isvisible' + + + + + + + + select title as activity_title, + item_id as structure_item_id, + structure_id, + structure_type + from imsld_activity_structuresi + where structure_id = :activity_id + + + + + + + + select 1 from imsld_status_user + where related_id = :structure_id + and user_id = :user_id + and status = 'started' + and run_id = :run_id + + + + + + + + select 1 from imsld_status_user + where related_id = :structure_id + and user_id = :user_id + and status = 'finish' + and run_id = :run_id + + + + + + + select ar.object_id_two, + ar.rel_type, + ar.rel_id, + case ar.rel_type + when 'imsld_as_la_rel' + then 'learning' + when 'imsld_as_sa_rel' + then 'support' + when 'imsld_as_as_rel' + then 'structure' + else 'none' + end as activity_type + from acs_rels ar, imsld_activity_structuresi ias + where ar.object_id_one = ias.item_id + and ias.structure_id = :activity_id + and content_item__get_live_revision(ar.object_id_two) is not null + order by ar.object_id_two + + + + + + + + select structure_id, + structure_type + from imsld_activity_structuresi + where item_id = :structure_item_id + + + + + Index: openacs-4/packages/imsld/lib/monitor/activity-info.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/monitor/activity-info.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/monitor/activity-info.adp 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,32 @@ + + (@visitors@ #imsld.users#) + + + (@visitors@ #imsld.user#) + + + (#imsld.No_users#) + + +
    + + + + Up + + + + + Down + + + + [ + + #imsld.Edit# + + + #imsld.Delete# + + ] +
    Index: openacs-4/packages/imsld/lib/monitor/activity-info.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/monitor/activity-info.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/monitor/activity-info.tcl 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,24 @@ + +if { $type eq "learning_object" } { + set visitors [imsld::monitor::number_of_visitors \ + -run_id $run_id \ + -revision_id $revision_id \ + -item_id $item_id \ + -type $type] +} else { + set visitors [imsld::monitor::number_of_visitors \ + -run_id $run_id \ + -revision_id $revision_id \ + -type $type] +} + +if { ![info exists item_id] } { + set item_id [content::revision::item_id -revision_id $revision_id] +} + +set url_up [export_vars -base change-activity-order {item_id run_id sort_order {dir -1}}] + +set bound_down [expr {$number_elements - 1}] +set url_down [export_vars -base change-activity-order {item_id run_id sort_order {dir 1}}] + +set url_del [export_vars -base activity-del {{activity_id $revision_id} run_id}] Index: openacs-4/packages/imsld/lib/monitor/activity-tree.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/monitor/activity-tree.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/monitor/activity-tree.adp 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,15 @@ + + Index: openacs-4/packages/imsld/lib/monitor/activity-tree.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/monitor/activity-tree.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/monitor/activity-tree.tcl 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,26 @@ + +multirow create activities activity_id type play_id act_id role_part_id + +db_1row imslds_in_class { + select imsld.item_id as imsld_item_id, + imsld.imsld_id, + coalesce(imsld.title, imsld.identifier) as imsld_title + from imsld_imsldsi imsld, imsld_runs run + where imsld.imsld_id = run.imsld_id + and run.run_id = :run_id +} + +# start with the role parts +set imsld_package_id [ad_conn package_id] + +# get the referenced role parts +foreach role_part_list [db_list_of_lists referenced_role_parts { *SQL* }] { + set type [lindex $role_part_list 0] + set activity_id [lindex $role_part_list 1] + set role_part_id [lindex $role_part_list 2] + set act_id [lindex $role_part_list 3] + set act_item_id [lindex $role_part_list 4] + set play_id [lindex $role_part_list 5] + + multirow append activities $activity_id $type $play_id $act_id $role_part_id +} Index: openacs-4/packages/imsld/lib/monitor/activity-tree.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/monitor/activity-tree.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/monitor/activity-tree.xql 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + select map.active_role_id as user_role_id + from imsld_run_users_group_rels map, + acs_rels ar, + imsld_run_users_group_ext iruge + where ar.rel_id = map.rel_id + and ar.object_id_one = iruge.group_id + and ar.object_id_two = :user_id + and iruge.run_id = :run_id + + + + + + + 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, + ip.play_id + from imsld_role_partsi rp, imsld_actsi ia, imsld_playsi ip, imsld_imsldsi ii, + imsld_methodsi im + 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 content_revision__is_live(rp.role_part_id) = 't' + and content_item__get_live_revision(coalesce(rp.learning_activity_id,rp.support_activity_id,rp.activity_structure_id)) + is not null + order by ip.sort_order, ia.sort_order, rp.sort_order + + + + + + + + select sa.title as activity_title, + sa.item_id as activity_item_id, + sa.activity_id, + attr.is_visible_p, + sa.complete_act_id + from imsld_support_activitiesi sa, imsld_attribute_instances attr + where sa.activity_id = :activity_id + and attr.owner_id = sa.activity_id + and attr.run_id = :run_id + and attr.user_id = :user_id + and attr.type = 'isvisible' + + + + + + + + select title as activity_title, + item_id as structure_item_id, + structure_id, + structure_type + from imsld_activity_structuresi + where structure_id = :activity_id + + + + + + + + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and status = 'started' + and run_id = :run_id + + + + + + + + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and status = 'finished' + and run_id = :run_id + + + + + Index: openacs-4/packages/imsld/lib/monitor/activity.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/monitor/activity.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/monitor/activity.adp 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,51 @@ + + + + @activity_title@ + + + + + + + + @activity_title@ + + + + + + + + @activity_title@ + + + +
      + +
    • + +
    • +
      +
    +
    +
    + +
    Index: openacs-4/packages/imsld/lib/monitor/activity.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/monitor/activity.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/monitor/activity.tcl 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,103 @@ +set act_item_id [content::revision::item_id -revision_id $act_id] +set user_id [ad_conn user_id] + +set structure_type "" +set completion_restriction 1 +if {[info exists structure_item_id]} { + # if the activity is in a structure, get the structure's info + db_1row structure_info { *SQL* } + set completion_restriction [imsld::structure_completion_resctriction_p -run_id $run_id -structure_item_id $structure_item_id] +} + +if {![info exists sort_order]} { + set sort_order 0 +} +if {![info exists siblings_number]} { + set siblings_number 0 +} + +switch $type { + learning { + # add the learning activity to the tree + + db_1row get_learning_activity_info { *SQL* } + + set user_choice_p [db_string user_choice_p { + select user_choice_p + from imsld_complete_actsi + where item_id = :complete_act_id + and content_revision__is_live(complete_act_id) = 't' + } -default "f"] + + set href [export_vars -base "activity-frame" -url {activity_id run_id type}] + set div $href + + } + support { + # add the support activity to the tree + db_1row get_support_activity_info { *SQL* } + set started_activity_p [db_0or1row already_started { + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'started' + }] + set completed_activity_p [db_0or1row already_completed { + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'finished' + }] + + set user_choice_p [db_string user_choice_p {select user_choice_p from imsld_complete_actsi where item_id = :complete_act_id and content_revision__is_live(complete_act_id) = 't'} -default "f"] + + if { $completed_activity_p + || ($structure_type eq "selection") + || (!$completion_restriction) + || ([lsearch -exact $next_activity_id_list $activity_id] != -1) + || ([string eq $complete_act_id ""] && [string eq $is_visible_p "t"] + && [lsearch -exact $active_acts_list $act_item_id] != -1) } { + + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + if { !$started_activity_p && [string eq $is_visible_p "t"] } { + # bold letters + set href [imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id] + set div [imsld::activity_url -div -activity_id $activity_id -run_id $run_id -user_id $user_id] + + set class "liOpen has_focus" + } else { + set href [imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id] + set div [imsld::activity_url -div -activity_id $activity_id -run_id $run_id -user_id $user_id] + + set class "liOpen" + } + + set finish_href "finish-component-element-${imsld_id}-${run_id}-${play_id}-${act_id}-${role_part_id}-${activity_id}-support.imsld" + + } + } + structure { + # this is a special case since there are some conditions to check + # in order to determine if the referenced activities have to be shown. + # because of that the proc generate_structure_activities_list is called, + # which returns a tcl list in tDOM format. + + # anyway, we add the structure to the tree only if: + # 1. the structure has already been started or finished + # 2. the referencer structure-type is "selection" + # (if it is the next activity to be done then it should had been marked as started + # in the "structure_next_activity" function. which is the case when structure-type is "sequence") + db_1row get_activity_structure_info { *SQL* } + + set href [export_vars -base "activity-frame" -url {activity_id run_id type}] + set div $href + + db_multirow -extend {r_activity_id} referenced_activities struct_referenced_activities { *SQL* } { + set r_activity_id [content::item::get_live_revision -item_id $object_id_two] + } + + } +} Index: openacs-4/packages/imsld/lib/monitor/activity.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/monitor/activity.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/lib/monitor/activity.xql 18 Feb 2009 19:01:13 -0000 1.1 @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + select la.title as activity_title, + la.item_id as activity_item_id, + la.activity_id, + la.complete_act_id + from imsld_learning_activitiesi la + where activity_id = :activity_id + + + + + + + + select sa.title as activity_title, + sa.item_id as activity_item_id, + sa.activity_id, + attr.is_visible_p, + sa.complete_act_id + from imsld_support_activitiesi sa, imsld_attribute_instances attr + where sa.activity_id = :activity_id + and attr.owner_id = sa.activity_id + and attr.run_id = :run_id + and attr.user_id = :user_id + and attr.type = 'isvisible' + + + + + + + + select title as activity_title, + item_id as structure_item_id, + structure_id, + structure_type + from imsld_activity_structuresi + where structure_id = :activity_id + + + + + + + select ar.object_id_two, + ar.rel_type, + ar.rel_id, + ir.sort_order, + case ar.rel_type + when 'imsld_as_la_rel' + then 'learning' + when 'imsld_as_sa_rel' + then 'support' + when 'imsld_as_as_rel' + then 'structure' + else 'none' + end as activity_type + from acs_rels ar, imsld_activity_structuresi ias, + (select * from imsld_as_la_rels union select * from imsld_as_sa_rels union + select * from imsld_as_as_rels) as ir + where ar.object_id_one = ias.item_id + and ar.rel_id = ir.rel_id + and ias.structure_id = :structure_id + and content_item__get_live_revision(ar.object_id_two) is not null + order by ir.sort_order, ar.object_id_two + + + + + + + + select structure_id, + structure_type + from imsld_activity_structuresi + where item_id = :structure_item_id + + + + +