Index: openacs-4/packages/categories/categories.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/categories/categories.info,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/categories/categories.info 8 Feb 2004 23:30:20 -0000 1.5
+++ openacs-4/packages/categories/categories.info 1 Apr 2004 12:58:17 -0000 1.6
@@ -8,13 +8,14 @@
f
categories
-
+
timo@timohentschel.de
Manage categories in category trees and let users map objects to categories.
2003-04-16
Datamodel for category trees with supporting API and management pages. Provides a widget for
general categorization of arbitrary objects and tracks which package instances use which category trees. Also supports localization.
-
+
+
Index: openacs-4/packages/categories/tcl/category-form-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/categories/tcl/category-form-procs.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/categories/tcl/category-form-procs.tcl 24 Mar 2004 10:39:58 -0000 1.2
+++ openacs-4/packages/categories/tcl/category-form-procs.tcl 1 Apr 2004 12:58:17 -0000 1.3
@@ -14,6 +14,7 @@
{-categorized_object_id}
{-form_name:required}
{-element_name "category_id"}
+ {-help_text {}}
} {
For each category tree associated with this container_object_id (usually
package_id) put a category widget into the ad_form. On form submission the
@@ -40,7 +41,10 @@
{category_subtree_id $subtree_id} \
{category_object_id {[value_if_exists categorized_object_id]}} \
{category_assign_single_p $assign_single_p} \
- {category_require_category_p $require_category_p}]]
+ {category_require_category_p $require_category_p} \
+ {help_text $help_text} \
+ ]]
+
}
}
Index: openacs-4/packages/categories/tcl/category-trees-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/categories/tcl/category-trees-procs.tcl,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/categories/tcl/category-trees-procs.tcl 6 Feb 2004 17:19:05 -0000 1.8
+++ openacs-4/packages/categories/tcl/category-trees-procs.tcl 1 Apr 2004 12:58:17 -0000 1.9
@@ -433,3 +433,63 @@
return "categories-browse?tree_ids=$object_id"
}
}
+
+
+ad_proc -public category_tree::get_multirow {
+ {-tree_id {}}
+ {-container_id {}}
+ {-category_counts {}}
+ -datasource
+} {
+ get a multirow datasource for a given tree or for all trees mapped to a
+ given container. datasource is:
+
+ tree_id tree_name category_id category_name level pad deprecated_p count
+
+ where mapped_p indicates the category_id was found in the list mapped_ids.
+
+ @parameter tree_id tree_id or container_id must be provided.
+ @parameter container_id returns all mapped trees for the given container_id
+ @parameter category_counts list of category_id and counts {catid count cat count ... }
+ @parameter datasource the name of the datasource to create.
+
+ @author Jeff Davis davis@xarg.net
+
+} {
+
+ if { [empty_string_p $tree_id] } {
+ if { [empty_string_p $container_id] } {
+ error "must provide either tree_id or container_id"
+ }
+ set mapped_trees [category_tree::get_mapped_trees $container_id]
+ } else {
+ set mapped_trees [list [list $tree_id [category_tree::get_name $tree_id] $subtree_id $assign_single_p $require_category_p]]
+ }
+ if { ![empty_string_p $mapped_trees]
+ && [llength $category_counts] > 1} {
+ array set counts $category_counts
+ } else {
+ array set counts [list]
+ }
+
+ template::multirow create $datasource tree_id tree_name category_id category_name level pad deprecated_p count
+ foreach mapped_tree $mapped_trees {
+ foreach {tree_id tree_name subtree_id assign_single_p require_category_p} $mapped_tree { break }
+ foreach category [category_tree::get_tree -subtree_id $subtree_id $tree_id] {
+ foreach {category_id category_name deprecated_p level} $category { break }
+ if { $level>1 } {
+ set pad "[string repeat " " [expr {2 * $level - 4}]].."
+ } else {
+ set pad {}
+ }
+ if {[info exists counts($category_id)]} {
+ set count $counts($category_id)
+ } else {
+ set count 0
+ }
+ template::multirow append $datasource $tree_id $tree_name $category_id $category_name $level $pad $deprecated_p $count
+ }
+ }
+
+ return [template::multirow size $datasource]
+}