Index: openacs-4/packages/lorsm/lib/user-lorsm.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/lib/user-lorsm.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/lorsm/lib/user-lorsm.tcl 21 Apr 2005 16:03:52 -0000 1.6 +++ openacs-4/packages/lorsm/lib/user-lorsm.tcl 26 Apr 2005 08:56:23 -0000 1.7 @@ -17,6 +17,9 @@ #set package_id $list_of_packages_ids +# link_url_eval {[site_node::get_url_from_object_id -object_id $lorsm_instance_id]${folder_name}/?[export_vars man_id]} +# link_html {title "[_ lorsm.Access_Course]" target "_blank"} + template::list::create \ -name d_courses \ @@ -28,10 +31,8 @@ -elements { course_name { label "[_ lorsm.Course_Name_1]" - display_col course_name + display_template {@d_courses.course_url;noquote@} html { width 70% } - link_url_eval {[site_node::get_url_from_object_id -object_id $lorsm_instance_id]${folder_name}/?[export_vars man_id]} - link_html {title "[_ lorsm.Access_Course]"} } subject { label "[_ lorsm.Subject]" @@ -56,7 +57,7 @@ foreach package $package_id { - db_multirow -extend { ims_md_id last_viewed total_item_count viewed_item_count viewed_percent delivery_folder} -append d_courses select_d_courses { + db_multirow -extend { ims_md_id last_viewed total_item_count viewed_item_count viewed_percent course_url } -append d_courses select_d_courses { select cp.man_id, cp.course_name, @@ -67,6 +68,7 @@ acs.creation_user, acs.creation_date, pf.folder_name, + pf.format_name, acs.context_id, cpmc.community_id, cpmc.lorsm_instance_id @@ -86,6 +88,11 @@ order by acs.creation_date desc } { set ims_md_id $man_id + if { [string eq $format_name "default"] } { + set course_url "$course_name" + } else { + set course_url "$course_name" + } # DEDS: these are expensive # and for demo purposes only Index: openacs-4/packages/lorsm/templates/lorsm-no-index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/templates/lorsm-no-index.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lorsm/templates/lorsm-no-index.tcl 22 Apr 2005 09:10:55 -0000 1.2 +++ openacs-4/packages/lorsm/templates/lorsm-no-index.tcl 26 Apr 2005 08:56:24 -0000 1.3 @@ -2,6 +2,7 @@ # The detected content type is "content_revision". lorsm::get_content content_revision +set user_id [ad_conn user_id] if { [info exists content(item_id)] } { if { ![string equal -length 4 "text" $content(mime_type)] } { @@ -38,7 +39,6 @@ and i.org_id = o.org_id }] } { # record view - set user_id [ad_conn user_id] set item_list [lorsm::get_item_list $man_id $user_id] set litem_list [llength $item_list] @@ -63,10 +63,38 @@ set viewed_item_id [lindex $item_list [expr [lsearch -exact $item_list $viewed_item_id] - 1]] } lorsm::record_view $viewed_item_id $man_id + + # Student tracking + set package_id [ad_conn package_id] + set community_id [dotlrn_community::get_community_id] + + if {[lorsm::track::istrackable -course_id $man_id -package_id $package_id]} { + + set track_id [lorsm::track::new \ + -user_id $user_id \ + -community_id $community_id \ + -course_id $man_id] + lorsm::track::exit -track_id $track_id + } + + # refresh the page every 300 seconds so we can have an estimate of the time when the user viewed the course for the last time + if { ![regsub -nocase {<\/head>} $text { + + + } text] } { + regsub -nocase {} $text { + + + + + } text + } } # parent window regsub -all -nocase {target=[^ |^>]+} $text {target="_parent"} text + + } ad_return_template Index: openacs-4/packages/lorsm/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/www/index.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/lorsm/www/index.tcl 21 Apr 2005 16:03:53 -0000 1.5 +++ openacs-4/packages/lorsm/www/index.tcl 26 Apr 2005 08:56:24 -0000 1.6 @@ -46,10 +46,8 @@ -elements { course_name { label "[_ lorsm.Available_Courses]" + display_template {@d_courses.course_url;noquote@} display_col course_name - link_url_eval {${folder_name}/?[export_vars man_id]} - link_html {title "[_ lorsm.Access_Course]"} - } hasmetadata { label "[_ lorsm.Metadata_1]" @@ -97,7 +95,7 @@ } -db_multirow -extend { ims_md_id } d_courses select_d_courses { +db_multirow -extend { ims_md_id course_url } d_courses select_d_courses { select cp.man_id, cp.course_name, @@ -116,6 +114,7 @@ acs.creation_user, acs.creation_date, pf.folder_name, + pf.format_name, acs.context_id, case when cpmc.isenabled = 't' then 'Enabled' @@ -139,5 +138,10 @@ order by acs.creation_date desc } { set ims_md_id $man_id + if { [string eq $format_name "default"] } { + set course_url "$course_name" + } else { + set course_url "$course_name" + } } Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/lorsm/www/delivery-no-index/body.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/lorsm/www/delivery-no-index/body.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/lorsm/www/delivery-no-index/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/www/delivery-no-index/index.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lorsm/www/delivery-no-index/index.adp 22 Apr 2005 09:10:55 -0000 1.1 +++ openacs-4/packages/lorsm/www/delivery-no-index/index.adp 26 Apr 2005 08:56:24 -0000 1.2 @@ -1,8 +1,18 @@ - - -@course_name@ + +
+ +

#lorsm.Welcome_to# @course_name@

+

- - - - + #lorsm.Your_Stats# +
+ #lorsm.lt_You_have_seen_this_co# @viewed_times@ #lorsm.lt_number_of_times_and_h# @viewed_percent@ % #lorsm.of_the_content# +

+ +

+ #lorsm.lt_The_last_page_you_vie# @last_page_viewed;noquote@ + + + #lorsm.Start# + + Index: openacs-4/packages/lorsm/www/delivery-no-index/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/www/delivery-no-index/index.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lorsm/www/delivery-no-index/index.tcl 22 Apr 2005 09:10:55 -0000 1.1 +++ openacs-4/packages/lorsm/www/delivery-no-index/index.tcl 26 Apr 2005 08:56:24 -0000 1.2 @@ -10,17 +10,13 @@ @cvs-id $Id$ } { man_id:integer,notnull - ims_id:integer,notnull,optional } -properties { } -validate { } -errors { } -if { [info exists ims_id] } { - set item_id $ims_id - - set body_url [export_vars -base "record-view" -url {item_id man_id}] -} +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] # Get the course name if {[db_0or1row manifest " @@ -41,17 +37,64 @@ set course_name "[_ lorsm.No_Course_Name]" } -# Student tracking -set package_id [ad_conn package_id] -set community_id [dotlrn_community::get_community_id] -set user_id [ad_conn user_id] +db_0or1row get_last_viewed { + select item_id as imsitem_id, coalesce(acs_object__name(object_id),'Item '||object_id) as last_page_viewed + from views v, + ims_cp_items i, + ims_cp_organizations o + where v.viewer_id = :user_id + and v.object_id = i.item_id + and i.org_id = o.org_id + and o.man_id = :man_id + order by v.last_viewed desc + limit 1 +} -if {[lorsm::track::istrackable -course_id $man_id -package_id $package_id]} { +set all_items [db_list get_total_items { + select i.item_id + from ims_cp_items i, + ims_cp_organizations o + where o.man_id = :man_id + and i.org_id = o.org_id +}] +set total_item_count [llength $all_items] +set viewed_items [db_list get_viewed_items " + select v.object_id + from views v + where v.viewer_id = :user_id + and v.object_id in ([join $all_items ,]) + "] +set viewed_item_count [llength $viewed_items] +set viewed_percent [lc_numeric [expr [expr $viewed_item_count * 1.00] / $total_item_count * 100] "%.2f"] + +#Get times viewed + +set viewed_times [db_string select_viewed_times " + select count(*) + from lorsm_student_track + where community_id = :community_id + and course_id = :man_id + and user_id = :user_id "] + +# Get the course name +if {[db_0or1row manifest " + select + cp.course_name, + cp.fs_package_id + from + ims_cp_manifests cp + where + cp.man_id = :man_id + and cp.parent_man_id = 0"]} { - set track_id [lorsm::track::new \ - -user_id $user_id \ - -community_id $community_id \ - -course_id $man_id] + # Course Name + if {[empty_string_p $course_name]} { + set course_name "[_ lorsm.No_Course_Name]" + } } else { - set track_id 0 + set course_name "[_ lorsm.No_Course_Name]" } + +if { !$viewed_item_count } { + set first_item_id [lindex [lorsm::get_item_list $man_id $user_id] 1] +} Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/lorsm/www/delivery-no-index/top.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/lorsm/www/delivery-no-index/top.tcl'. Fisheye: No comparison available. Pass `N' to diff?