Index: openacs-4/contrib/packages/bcms/tcl/bcms-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/bcms/tcl/bcms-item-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/bcms/tcl/bcms-item-procs.tcl 4 Aug 2003 11:19:46 -0000 1.2 +++ openacs-4/contrib/packages/bcms/tcl/bcms-item-procs.tcl 27 Aug 2003 17:23:27 -0000 1.3 @@ -81,6 +81,8 @@ return $item_id } + +#TODO: use the views to update ad_proc -public bcms::item::set_item { {-item_id:required} {-name} @@ -123,7 +125,7 @@ {-content_type content_revision} {-multirow_name bcms_list_items} {-return_list:boolean false} - {-additional_columns [list]} + {-additional_columns} } { Gets all content item under the parent_id @@ -146,7 +148,11 @@ # initialize the addtionals we will use set addtnl_where_list [list] - set addtnl_select_list $additional_columns + if {[info exists additional_columns]} { + set addtnl_select_list $additional_columns + } else { + set addtnl_select_list [list] + } # if additional revision data must be returned, set the additional columns here # for revisions. @@ -182,8 +188,9 @@ set addtnl_select_list [linsert $addtnl_select_list 0 r.title r.description] set addtnl_select ", [join $addtnl_select_list ", "]" } else { - set addtnl_select "" set addtnl_select_folder "" + set addtnl_select_list [linsert $addtnl_select_list 0 r.title r.description] + set addtnl_select ", [join $addtnl_select_list ", "]" } if {$return_list_p} { @@ -322,6 +329,7 @@ } +#TODO: use the views to select the revision info ad_proc -public bcms::item::get_item_by_url { {-root_id:required} {-url:required} @@ -372,6 +380,7 @@ } } +#TODO: use the views to select the revision info ad_proc -public bcms::item::get_item { {-item_id:required} {-revision} @@ -603,26 +612,91 @@ {-root_id} {-prepend_path ''} {-multirow_name bcms_item_path} - {-return_list:boolean false} + {-return_list:boolean} + {-no_parent:boolean} } { - returns a path from the root_id to the item_id. + returns a multirow/list of path from the root_id to the item_id. - @param item_id build the path to this item + @param item_id build the path to this item @param root_id build the path from this folder, if not supplied it use the current bcms root @param prepend_path you can add a string to prepend the path column @param multirow_name you can supply your own multirow name @param return_list if supplied a list of ns_sets otherwise it returns a multirow uses the multirow_name if given - @returns the following attributes item_id, path, title + @param no_parent does not return additional rows containing the parents to this item + + @returns a multirow/list with following elements item_id, path, title } { if ![info exists root_id] { # if the parent_id does not exists then start from the root set root_id [bcms::folder::get_bcms_root_folder] } + if {$no_parent_p} { + set addtnl_where "and i.item_id = :item_id" + } else { + set addtnl_where "" + } + if {$return_list_p} { return [db_list_of_ns_sets get_item_path "SQL"] } else { db_multirow $multirow_name get_item_path "SQL" } } + + +ad_proc -public bcms::item::assign_category { + {-category_id:required} + {-item_id:required} +} { + + categorize a content item to a category + + @param category_id The keyword id of the category we map to + @param item_id The item id of the content item we map + +} { + return [db_exec_plsql assign_category "SQL"] +} + + +ad_proc -public bcms::item::unassign_category { + {-category_id:required} + {-item_id:required} +} { + + removes map of a category to a content item + + @param category_id The category id of the category we unmap to + @param item_id The item id of the content item we unmap + +} { + return [db_exec_plsql unassign_category "SQL"] +} + + +ad_proc -public bcms::item::clear_categories { + {-item_id:required} +} { + clears all the assigned categories for a particular item + + @param item_id The item id of the content item we unmap +} { + db_list unassign_all_category "SQL" +} + + +# TODO: make this similar to list_X calls? +ad_proc -public bcms::item::get_categories { + {-item_id:required} +} { + get the categories assigned to this item + + @param item_id id of the item + + @returns category ids assigned to this item +} { + + return [db_list get_categories "SQL"] +}