Index: openacs-4/packages/categories/lib/categorize.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/lib/categorize.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/categories/lib/categorize.adp 10 Mar 2005 18:27:41 -0000 1.1 @@ -0,0 +1,6 @@ +

Categorize @name@

+ +

Current categories

+

@catass_list;noquote@

+
+ Index: openacs-4/packages/categories/lib/categorize.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/lib/categorize.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/categories/lib/categorize.tcl 10 Mar 2005 18:27:41 -0000 1.1 @@ -0,0 +1,29 @@ +if {![exists_and_not_null object_id]} { + ad_complain "You must specify an object to categorize" +} + +if {![exists_and_not_null container_id]} { + set container_id [ad_conn subsite_id] +} + +set name [db_string title {select title from acs_objects where object_id = :object_id} -default $object_id] + +# Category mapping stuff +# add category form +ad_form -action map -method GET -name catass -form { + {object_id:integer(hidden) + {value $object_id} + } + {container_id:integer(hidden) + {value $container_id} + } +} + +category::ad_form::add_widgets -container_object_id $container_id -form_name catass + +# mapped categories: +set catass_list [category::list::get_pretty_list \ + -category_link_eval "list-categories?cat=\$__category_id" \ + -remove_link_eval "remove?cat=\$__category_id&object_id=$object_id" \ + -remove_link_text "X" \ + [category::get_mapped_categories $object_id]] Index: openacs-4/packages/categories/lib/list-categories.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/lib/list-categories.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/categories/lib/list-categories.adp 10 Mar 2005 18:27:41 -0000 1.1 @@ -0,0 +1,21 @@ +
+
+ +

@categories.tree_name@

+
    + +
  • @categories.pad;noquote@@categories.category_name@ (@categories.count@)
  • + + +
  • @categories.pad;noquote@@categories.category_name@ (@categories.count@)@categories.category_name@ +
  • +
    +
    +
    +
+
+
+
+ +
+
Index: openacs-4/packages/categories/lib/list-categories.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/lib/list-categories.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/categories/lib/list-categories.tcl 10 Mar 2005 18:27:41 -0000 1.1 @@ -0,0 +1,23 @@ +if {![exists_and_not_null cat]} { + set cat {} +} + +if {![exists_and_not_null orderby]} { + set orderby "object_title" +} + +# Get category data. +set counts {} +set node_id [ad_conn node_id] +set packages [categories-ui::util::packages -node_id $node_id] +db_foreach category_count " + SELECT c.category_id as catid, count(*) as count + FROM category_object_map c, acs_objects o + where c.object_id = o.object_id + and o.package_id in ([join $packages ,]) + group by c.category_id +" { + lappend counts $catid $count +} + +category_tree::get_multirow -datasource categories -container_id [ad_conn subsite_id] -category_counts $counts Index: openacs-4/packages/categories/lib/map.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/lib/map.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/categories/lib/map.adp 10 Mar 2005 18:27:41 -0000 1.1 @@ -0,0 +1 @@ +OK \ No newline at end of file Index: openacs-4/packages/categories/lib/map.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/lib/map.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/categories/lib/map.tcl 10 Mar 2005 18:27:41 -0000 1.1 @@ -0,0 +1,27 @@ +if {![exists_and_not_null object_id]} { + ad_complain "You must specify an item to map" +} + +if {![exists_and_not_null container_id]} { + ad_complain "You must specify a container to map the object to" +} + +ad_form -name catass -form { + {object_id:integer(hidden) + {value $object_id} + } + {container_id:integer(hidden) + {value $container_id} + } +} +category::ad_form::add_widgets -container_object_id $container_id -form_name catass +ad_form -extend -name catass -on_submit { + ns_log Notice "JCD: trees [category_tree::get_mapped_trees $container_id]" + set category_ids [category::ad_form::get_categories -container_object_id $container_id] + ns_log Notice "JCD: mapping $category_ids" + category::map_object \ + -object_id $object_id \ + $category_ids +} + +ad_returnredirect [get_referrer] Index: openacs-4/packages/faq/faq.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/faq.info,v diff -u -r1.14 -r1.15 --- openacs-4/packages/faq/faq.info 24 Feb 2005 13:33:17 -0000 1.14 +++ openacs-4/packages/faq/faq.info 10 Mar 2005 18:27:41 -0000 1.15 @@ -7,7 +7,7 @@ f f - + Elizabeth Wirth Jennie Kim Housman Nima Mazloumi @@ -17,14 +17,15 @@ Ybos Corporation Handles frequently asked questions Q&A presentation. Can be one Q&A per page or all presented flat. Straightforward application with room for improvement. Support for notification as well as WYSIQYG Editor and Categories - both optional. Category trees are displayed flat. No multiple filters. - + + Index: openacs-4/packages/faq/www/one-faq.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/one-faq.adp,v diff -u -r1.12 -r1.13 --- openacs-4/packages/faq/www/one-faq.adp 12 Aug 2004 13:57:46 -0000 1.12 +++ openacs-4/packages/faq/www/one-faq.adp 10 Mar 2005 18:27:41 -0000 1.13 @@ -22,6 +22,7 @@
  • @one_question.question;noquote@ + Categorize
  • @@ -54,4 +55,4 @@
    #faq.All_QA# - \ No newline at end of file + Index: openacs-4/packages/faq/www/categories/categorize.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/categories/categorize.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq/www/categories/categorize.adp 10 Mar 2005 18:27:41 -0000 1.1 @@ -0,0 +1,4 @@ + +@context;noquote@ + + Index: openacs-4/packages/faq/www/categories/categorize.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/categories/categorize.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq/www/categories/categorize.tcl 10 Mar 2005 18:27:41 -0000 1.1 @@ -0,0 +1,11 @@ +ad_page_contract { + +} { + object_id:integer +} + +set container_id [ad_conn [parameter::get -parameter CategoryContainer -default package_id]] + +set context Categorize + +ad_return_template Index: openacs-4/packages/faq/www/categories/list-categories.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/categories/list-categories.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq/www/categories/list-categories.adp 10 Mar 2005 18:27:41 -0000 1.1 @@ -0,0 +1,4 @@ + + @cat_name@ + + Index: openacs-4/packages/faq/www/categories/list-categories.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/categories/list-categories.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq/www/categories/list-categories.tcl 10 Mar 2005 18:27:41 -0000 1.1 @@ -0,0 +1,12 @@ +ad_page_contract { + Main category display page + @author Jeff Davis (davis@xarg.net) + @cvs-id $Id: list-categories.tcl,v 1.1 2005/03/10 18:27:41 rob Exp $ +} { + {cat:trim,integer {}} + {orderby "object_title"} +} + +set cat_name [category::get_names $cat] + +ad_return_template Index: openacs-4/packages/faq/www/categories/map.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/categories/map.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq/www/categories/map.adp 10 Mar 2005 18:27:41 -0000 1.1 @@ -0,0 +1 @@ + Index: openacs-4/packages/faq/www/categories/map.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/categories/map.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq/www/categories/map.tcl 10 Mar 2005 18:27:41 -0000 1.1 @@ -0,0 +1,7 @@ +ad_page_contract { +} { + object_id:integer,notnull + container_id:integer,notnull +} + +ad_return_template Index: openacs-4/packages/faq/www/categories/remove.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/categories/remove.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq/www/categories/remove.tcl 10 Mar 2005 18:27:41 -0000 1.1 @@ -0,0 +1,9 @@ +ad_page_contract { +} { + object_id:integer,notnull + cat:integer,notnull +} + +db_dml nuke {delete from category_object_map where category_id = :cat and object_id = :object_id} + +ad_returnredirect -message "removed category" [get_referrer]