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.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 + +