Index: openacs-4/packages/dotlrn-catalog/lib/tree-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/tree-chunk.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn-catalog/lib/tree-chunk.tcl 14 Feb 2005 22:46:11 -0000 1.1 +++ openacs-4/packages/dotlrn-catalog/lib/tree-chunk.tcl 19 Feb 2005 02:32:07 -0000 1.2 @@ -5,38 +5,68 @@ @creation-date 11-02-2005 } { - + category_f:optional + uncat_f:optional } - +# Get all tree categories set tree_list [category_tree::get_tree -all $tree_id] -set tree_view "" -set cat_obj_list [dotlrn_catalog::get_categories_from_tree -tree_id $tree_id] - -# Display all courses associated to one category +# Create a list of values for the list filter +set tree [list] foreach element $tree_list { - set level [lindex $element 3] + set ident [lindex $element 3] set spacer "" - for { set i 0 } { $i < $level } { incr i } { - append spacer "     " + for { set i 1 } { $i < $ident } { incr i } { + append spacer ". . " } - if { [string equal $level 1] } { - append tree_view "${spacer}[lindex $element 1]
" - } else { - append tree_view "${spacer}[lindex $element 1]
" - } - foreach item $cat_obj_list { - if { [string equal [lindex $item 0] [lindex $element 0] ]} { - set course_id "[lindex $item 1]" - db_0or1row get_course_info { } - append tree_view "${spacer}    ($course_key) $course_name
" + lappend tree [list "${spacer}[lindex "$element" 1]" [lindex $element 0]] +} + +# Get all objects_ids and category_id +set cat_obj_list [dotlrn_catalog::get_categories_from_tree -tree_id $tree_id] + +template::list::create \ + -name course_list \ + -multirow course_list \ + -key course_id \ + -filters { + category_f { + label "[_ dotlrn-catalog.categories]" + values { $tree } + where_clause { dc.course_id in ( select object_id from category_object_map where category_id = :category_f )} } + uncat_f { + label "[_ dotlrn-catalog.uncat]" + values { "Watch" } + where_clause { dc.course_id not in ( select object_id from category_object_map where category_id in \ + ( select category_id from categories where tree_id =:tree_id )) + } + } + } \ + -bulk_action_method post \ + -bulk_action_export_vars { + }\ + -row_pretty_plural "[_ dotlrn-catalog.courses]" \ + -elements { + course_key { + label "[_ dotlrn-catalog.course_key]" + display_template { +
+ @course_list.course_key@ +
+ } + } + name { + label "[_ dotlrn-catalog.course_name]" + display_template { +
+ @course_list.course_name@ +
+ } + } } -} -# Display courses without category -set uncat_p 0 -db_multirow uncat get_courses_uncat { } { - set uncat_p 1 -} \ No newline at end of file + +db_multirow course_list get_courses {} +