Index: openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl 31 May 2005 22:04:53 -0000 1.1 +++ openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl 4 Jun 2005 10:05:17 -0000 1.2 @@ -9,7 +9,7 @@ uncat_f:optional { level "" } - + instructor:optional { orderby course_name } { groupby course_name } } @@ -35,7 +35,7 @@ set filter_list [list category_f] -set form [ns_getform] +set form [rp_getform] foreach tree [category_tree::get_mapped_trees $package_id] { set tree_name [lindex $tree 1] @@ -167,6 +167,28 @@ ] } +set instructor_community_id [parameter::get -package_id [ad_conn package_id] -parameter InstructorCommunityId -default 0 ] +set _instructors [dotlrn_community::list_users $instructor_community_id] +set __instructors [list] +if { [llength $_instructors] == 0 } { + set _instructors 0 +} else { + foreach _instructor $_instructors { + lappend __instructors [ns_set get $_instructor user_id] + lappend instructors_filter [list "[ns_set get $_instructor first_names] [ns_set get $_instructor last_name]" [ns_set get $_instructor user_id]] + } +} + +lappend filters instructor \ + [list \ + label "[_ dotlrn-ecommerce.Instructor]" \ + values $instructors_filter \ + where_clause_eval {subst {exists (select 1 + from dotlrn_users u, dotlrn_member_rels_approved r + where u.user_id = r.user_id + and r.community_id = dec.community_id + and r.rel_type = 'dotlrn_admin_rel' + and r.user_id in ([join $instructor ,]))}}] # Section categories #foreach section_tree [category_tree::get_mapped_trees $package_id] { # set tree_list [category_tree::get_tree -all $section_tree] @@ -178,14 +200,28 @@ # where_clause { ${Age Description_where_query} } # } +set filters [linsert $filters 0 view { + label "[_ dotlrn-ecommerce.View]" + values { {"" ""} {Calendar "calendar"} } +}] + set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] set admin_p [permission::permission_p -object_id $cc_package_id -privilege "admin"] + +set actions [list] + +lappend actions "[_ dotlrn-ecommerce.View_All]" ? "[_ dotlrn-ecommerce.View_All]" + +if { $admin_p } { + lappend actions "[_ dotlrn-ecommerce.Add_Course]" admin/course-add-edit "[_ dotlrn-ecommerce.View_All]" +} + template::list::create \ -name course_list \ -multirow course_list \ -key course_id \ -pass_properties { admin_p } \ - -actions {"View All" ? "View All"} \ + -actions $actions \ -filters $filters \ -bulk_action_method post \ -bulk_action_export_vars { @@ -245,15 +281,15 @@ label "" display_template { - (add to cart) + [_ dotlrn-ecommerce.add_to_cart] - (edit) + [_ dotlrn-ecommerce.edit] } - html { width 50% } + html { width 50% nowrap } } } -orderby { course_name { @@ -263,7 +299,7 @@ label "Group by" type multivar values { - { { (info) (edit) (add section) + { { [_ dotlrn-ecommerce.info] [_ dotlrn-ecommerce.edit] [_ dotlrn-ecommerce.add_section]
@course_list.course_grades@
@course_list.course_info;noquote@ @@ -273,15 +309,6 @@ } -set instructor_community_id [parameter::get -package_id [ad_conn package_id] -parameter InstructorCommunityId -default 0 ] -set _instructors [dotlrn_community::list_users $instructor_community_id] -if { [llength $_instructors] == 0 } { - set _instructors 0 -} else { - foreach instructor $_instructors { - lappend __instructors [ns_set get $instructor user_id] - } -} set grade_tree_id [db_string grade_tree { select tree_id from category_tree_translations @@ -343,18 +370,21 @@ # Build sessions set calendar_id [dotlrn_calendar::get_group_calendar_id -community_id $community_id] - + lappend calendar_id_list $calendar_id set sessions [util_memoize [list dotlrn_ecommerce::section::sessions $calendar_id]] set instructors [util_memoize [list dotlrn_ecommerce::section::instructors $community_id $__instructors]] if { [llength $instructors] == 1 } { - set instructors "Instructor: [join $instructors ", "] (view bio)" + set instructors "Instructor: [join $instructors ", "]" } elseif { [llength $instructors] > 1 } { - set instructors "Instructors: [join $instructors ", "] (view bios)" + set instructors "Instructors: [join $instructors ", "]" } else { set instructors "" } + if { ! [empty_string_p $instructors] && $member_p } { + append instructors " [_ dotlrn-ecommerce.view_bios]" + } } if { ! [empty_string_p $product_id] } {