Index: openacs-4/packages/dotlrn-catalog/lib/course-chunk.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/course-chunk.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn-catalog/lib/course-chunk.xql 19 Feb 2005 02:32:07 -0000 1.3 +++ openacs-4/packages/dotlrn-catalog/lib/course-chunk.xql 21 Feb 2005 19:22:12 -0000 1.4 @@ -3,7 +3,7 @@ - select 1 from category_object_map where object_id = :course_id + select count(object_id) from category_object_map where object_id = :course_id Index: openacs-4/packages/dotlrn-catalog/lib/tree-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/tree-chunk.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/lib/tree-chunk.adp 19 Feb 2005 02:32:07 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/lib/tree-chunk.adp 21 Feb 2005 19:22:12 -0000 1.3 @@ -1,12 +1,11 @@
-
+
- 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.3 -r1.4 --- openacs-4/packages/dotlrn-catalog/lib/tree-chunk.tcl 19 Feb 2005 03:43:11 -0000 1.3 +++ openacs-4/packages/dotlrn-catalog/lib/tree-chunk.tcl 21 Feb 2005 19:22:12 -0000 1.4 @@ -7,25 +7,68 @@ } { category_f:optional uncat_f:optional + { level "" } } +if { [info exist category_f] } { + set var_list [split $category_f "&"] + set category_v [lindex $var_list 0] + set level [lindex [split [lindex $var_list 1] "="] 1] +} else { + set category_v "" +} + + # Get all tree categories set tree_list [category_tree::get_tree -all $tree_id] +set tree_length [llength $tree_list] # Create a list of values for the list filter set tree [list] + foreach element $tree_list { set ident [lindex $element 3] set spacer "" for { set i 1 } { $i < $ident } { incr i } { append spacer ". . " } - lappend tree [list "${spacer}[lindex "$element" 1]" [lindex $element 0]] + lappend tree [list "${spacer}[lindex "$element" 1]" "[lindex $element 0]&level=[lindex $element 3]" ] } -# Get all objects_ids and category_id -set cat_obj_list [dotlrn_catalog::get_categories_from_tree -tree_id $tree_id] +# Get all sub categories +set map_tree "(" +if { ![string equal $level ""] } { + set j 0 + set i 0 + while { $i < $tree_length } { + set element [lindex $tree_list $i] + if {[string equal $category_v [lindex $element 0]] } { + append map_tree "[lindex $element 0]," + set pos $i + set i $tree_length + } + incr i + } + set j 0 + set i [expr $pos + 1] + while { $i < $tree_length } { + set element [lindex $tree_list $i] + if { $level < [lindex $element 3] } { + append map_tree "[lindex $element 0]," + incr i + } else { + set i $tree_length + } + } + append map_tree "0)" +} +if { [string equal $category_v ""] } { + set where_query "dc.course_id in ( select object_id from category_object_map_tree where tree_id = :tree_id )" +} else { + set where_query "dc.course_id in ( select object_id from category_object_map_tree where tree_id = :tree_id and category_id in $map_tree )" +} + template::list::create \ -name course_list \ -multirow course_list \ @@ -34,7 +77,7 @@ 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 )} + where_clause { $where_query } } uncat_f { label "[_ dotlrn-catalog.uncat]" Index: openacs-4/packages/dotlrn-catalog/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/tcl/apm-callback-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn-catalog/tcl/apm-callback-procs.tcl 14 Feb 2005 22:46:11 -0000 1.1 +++ openacs-4/packages/dotlrn-catalog/tcl/apm-callback-procs.tcl 21 Feb 2005 19:22:13 -0000 1.2 @@ -84,7 +84,7 @@ } { # To categorize courses set tree_id [category_tree::add -name "dotlrn-course-catalog"] - category_tree::map -tree_id $tree_id -object_id $package_id -assign_single_p "t" + category_tree::map -tree_id $tree_id -object_id $package_id } ad_proc -private dotlrn-catalog::package_uninstall { Index: openacs-4/packages/dotlrn-catalog/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/index.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/www/index.adp 14 Feb 2005 22:55:39 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/www/index.adp 21 Feb 2005 19:22:13 -0000 1.3 @@ -1,6 +1,15 @@ @page_title@ @context;noquote@ + + +
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.adp 16 Feb 2005 22:21:30 -0000 1.3 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.adp 21 Feb 2005 19:22:13 -0000 1.4 @@ -19,4 +19,5 @@
- \ No newline at end of file + + Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.tcl 16 Feb 2005 22:21:30 -0000 1.4 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.tcl 21 Feb 2005 19:22:13 -0000 1.5 @@ -131,5 +131,11 @@ set item_id [dotlrn_catalog::get_item_id -revision_id $course_id] set creation_user [dotlrn_catalog::get_creation_user -object_id $item_id] set rel [dotlrn_catalog::has_relation -course_id $course_id] - set category_name "[category::get_name [category::get_mapped_categories $course_id]]" -} \ No newline at end of file + set category_name "" + set mapped [category::get_mapped_categories $course_id] + foreach element $mapped { + append category_name "[category::get_name $element], " + } + set category_name [string range $category_name 0 [expr [string length $category_name] - 3]] +} + Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.adp 16 Feb 2005 00:22:12 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.adp 21 Feb 2005 19:22:13 -0000 1.3 @@ -5,5 +5,7 @@ +
+