Index: openacs-4/packages/acs-subsite/tcl/application-group-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/application-group-procs.tcl,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/acs-subsite/tcl/application-group-procs.tcl 15 Feb 2009 00:53:55 -0000 1.11 +++ openacs-4/packages/acs-subsite/tcl/application-group-procs.tcl 3 Mar 2009 21:35:54 -0000 1.12 @@ -178,6 +178,12 @@ return $group_id } +ad_proc -public application_group::package_id_from_group_id { + -group_id:required +} { + return [db_string get {}] +} + ad_proc -public application_group::new { { -group_id "" } { -group_type "application_group"} Index: openacs-4/packages/acs-subsite/tcl/application-group-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/Attic/application-group-procs.xql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/acs-subsite/tcl/application-group-procs.xql 28 Aug 2003 09:41:39 -0000 1.5 +++ openacs-4/packages/acs-subsite/tcl/application-group-procs.xql 3 Mar 2009 21:35:54 -0000 1.6 @@ -1,6 +1,14 @@ + + + select package_id + from application_groups + where group_id = :group_id + + + Index: openacs-4/packages/lors/tcl/lors-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-procs.tcl,v diff -u -N -r1.15 -r1.16 --- openacs-4/packages/lors/tcl/lors-procs.tcl 15 Feb 2009 00:53:00 -0000 1.15 +++ openacs-4/packages/lors/tcl/lors-procs.tcl 3 Mar 2009 21:35:54 -0000 1.16 @@ -11,6 +11,17 @@ namespace eval lors:: {} +# DRB: All of this community cruft is due to the fact that the datamodel for +# courses stupidly ties them to groups (originally limited to .LRN communities), +# in addition to the appropriate package id. It should be totally rewritten. + +ad_proc lors::get_community_node_id { + -community_id:required +} { + return [site_node::get_node_id_from_object_id \ + -object_id [application_group::package_id_from_group_id -group_id $community_id]] +} + ad_proc lors::get_community_element { {-node_id ""} -element:required 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 -N -r1.28 -r1.29 --- openacs-4/packages/lorsm/lib/user-lorsm.tcl 15 Feb 2009 00:50:42 -0000 1.28 +++ openacs-4/packages/lorsm/lib/user-lorsm.tcl 3 Mar 2009 21:35:54 -0000 1.29 @@ -1,119 +1,22 @@ -# packages/lorsm/www/test.tcl - -ad_page_contract { - - testing background - - @author Ernie Ghiglione (ErnieG@mm.st) - @creation-date 2004-06-15 - @arch-tag: 9d893919-9a02-45cd-b6ad-19e3a34ba747 - @cvs-id $Id$ -} { -} -properties { -} -validate { -} -errors { -} - set user_id [ad_conn user_id] -set community_id [lors::get_community_id] +set our_community_id [lors::get_community_id] set lors_central_package_id [apm_package_id_from_key "lors-central"] set lors_central_url [apm_package_url_from_id $lors_central_package_id] -set elements_list { - course_name { - label "[_ lorsm.Course_Name_1]" - display_template { - @d_courses.course_url;noquote@ - - - -          - #lors-central.add_mat# - - - - } - html { style "width:70%" } - } -} - -if { [empty_string_p $community_id] } { - append elements_list { - subject { - label "[_ lorsm.Subject]" - display_eval {[lors::get_community_name]} - html { align center style "width:20%" } - link_url_eval {[lors::get_community_url]} - link_html {title "[_ lorsm.Access_Course]"} - } - } -} - -append elements_list { - last_viewed { - label "[_ lorsm.Last_Viewed_On]" - html { align center style "width:10%" } - display_eval {[lc_time_fmt $last_viewed "%x"]} - - } viewed_percent { - label "[_ lorsm._Viewed]" - html { align right } - display_eval {[lc_numeric $viewed_percent "%.2f"]} - } lesson_status { - label "Completed" - html { align center } - display_template { @d_courses.lesson_status;noquote@ } - } -} - - -#label "[_ lorsm._CourseStatus]" - -if { ![string equal $lors_central_package_id 0] && ![empty_string_p $community_id] } { - if { [lors_central::check_inst -user_id $user_id -community_id $community_id] } { - append elements_list " - grant_permissions { - label \"[_ lors-central.grant_permissions]\" - display_template { -
- - [_ lors-central.manage] - -
- } - }" - - } else { - set lors_central_p 0 - } - set lors_central_p 1 -} else { - set lors_central_p 0 -} - -template::list::create \ - -name d_courses \ - -multirow d_courses \ - -html {width 100%} \ - -key man_id \ - -no_data "[_ lorsm.No_Courses]" \ - -elements $elements_list - -set extra_query "" -if {![empty_string_p $community_id]} { - set extra_query "and cpmc.community_id = :community_id" -} - +set add_subject_p 0 foreach package $package_id { db_multirow \ -extend { admin_p item_id ims_md_id last_viewed \ total_item_count viewed_item_count viewed_percent course_url \ - lesson_status + lesson_status community_name community_url } -append d_courses select_d_courses { } { + if { $community_id != $our_community_id } { + set add_subject_p 1 + set community_node_id [lors::get_community_node_id -community_id $community_id] + set community_name [lors::get_community_name -node_id $community_node_id] + set community_url [lors::get_community_url -node_id $community_node_id] + } set ims_md_id $man_id if { [string eq $format_name "default"] } { @@ -228,5 +131,87 @@ } } +set elements_list { + course_name { + label "[_ lorsm.Course_Name_1]" + display_template { + @d_courses.course_url;noquote@ + + + +          + #lors-central.add_mat# + + + + } + html { style "width:70%" } + } +} +if { $add_subject_p } { + append elements_list { + subject { + label "[_ lorsm.Subject]" + display_eval { $community_name } + html { align center style "width:20%" } + link_url_eval { $community_url } + link_html {title "[_ lorsm.Access_Course]"} + } + } +} +append elements_list { + last_viewed { + label "[_ lorsm.Last_Viewed_On]" + html { align center style "width:10%" } + display_eval {[lc_time_fmt $last_viewed "%x"]} + + } viewed_percent { + label "[_ lorsm._Viewed]" + html { align right } + display_eval {[lc_numeric $viewed_percent "%.2f"]} + } lesson_status { + label "Completed" + html { align center } + display_template { @d_courses.lesson_status;noquote@ } + } +} + + +#label "[_ lorsm._CourseStatus]" + +if { ![string equal $lors_central_package_id 0] && ![empty_string_p $our_community_id] } { + if { [lors_central::check_inst -user_id $user_id -community_id $our_community_id] } { + append elements_list " + grant_permissions { + label \"[_ lors-central.grant_permissions]\" + display_template { +
+ + [_ lors-central.manage] + +
+ } + }" + + } else { + set lors_central_p 0 + } + set lors_central_p 1 +} else { + set lors_central_p 0 +} + +template::list::create \ + -name d_courses \ + -multirow d_courses \ + -html {width 100%} \ + -key man_id \ + -no_data "[_ lorsm.No_Courses]" \ + -elements $elements_list + + Index: openacs-4/packages/lorsm/lib/user-lorsm.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/lib/user-lorsm.xql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/lorsm/lib/user-lorsm.xql 12 Dec 2008 14:25:32 -0000 1.4 +++ openacs-4/packages/lorsm/lib/user-lorsm.xql 3 Mar 2009 21:35:54 -0000 1.5 @@ -16,7 +16,6 @@ where cp.man_id = acs.object_id and cp.man_id = cpmc.man_id and cpmc.lorsm_instance_id = :package - $extra_query and cpmc.isenabled = 't' and pf.format_id = cp.course_presentation_format order by acs.creation_date desc