Home
The Toolkit for Online Communities
17219 Community Members, 1 member online, 2047 visitors today
Log In Register
OpenACS Home : ACS API Browser : Categories 1.1.2d4 : categories-procs.tcl
Publicity:
[Public Only | All]

categories-procs.tcl

Procs for the site-wide categorization package.
Location:
packages/categories/tcl/categories-procs.tcl
Created:
16 April 2003
Author:
Timo Hentschel <timo@timohentschel.de>
CVS Identification:
$Id: categories-procs.tcl,v 1.28 2010/01/13 17:07:00 ryang Exp $

Procedures in this file

Detailed information

category::add (public)

category::add [ -category_id category_id ] -tree_id tree_id \
    -parent_id parent_id -name name [ -locale locale ] \
    [ -description description ] [ -deprecated_p deprecated_p ] \
    [ -user_id user_id ] [ -creation_ip creation_ip ] [ -noflush ]
Insert a new category. The same translation will be added in the default language if it's in a different language.

Switches:
-category_id (optional)
-tree_id (required)
-parent_id (required)
-name (required)
-locale (optional)
-description (optional)
-deprecated_p (defaults to "f") (optional)
-user_id (optional)
-creation_ip (optional)
-noflush (boolean) (optional)
Options:
-category_id
category_id of the category to be inserted.
-locale
locale of the language. [ad_conn locale] used by default.
-name
category name.
-description
description of the category.
-deprecated_p
is category deprecated?
-tree_id
tree_id of the category the category should be added.
-parent_id
id of the parent category. "" if top level category.
-user_id
user that adds the category. [ad_conn user_id] used by default.
-creation_ip
ip-address of the user that adds the category. [ad_conn peeraddr] used by default.
-noflush
defer calling category_tree::flush_cache (which if adding multiple categories to a large tree can be very expensive). note that if you set this flag you must call category_tree::flush_cache once the adds are complete.
Returns:
category_id
Author:
Timo Hentschel <timo@timohentschel.de>
 

category::change_parent (public)

category::change_parent -category_id category_id -tree_id tree_id \
    [ -parent_id parent_id ]
Changes parent category of a category.

Switches:
-category_id (required)
-tree_id (required)
-parent_id (defaults to "[db_null]") (optional)
Options:
-category_id
category_id whose parent should change.
-tree_id
tree_id of the category tree.
-parent_id
new parent category_id.
Author:
Timo Hentschel <timo@timohentschel.de>
 

category::count_children (public)

category::count_children -category_id category_id
counts all direct sub categories

Switches:
-category_id (required)
 

category::delete (public)

category::delete [ -batch_mode ] category_id
Deletes a category. category_tree::flush_cache should be used afterwards.

Switches:
-batch_mode (boolean) (optional)
Parameters:
category_id - category_id of the category to be deleted.
Options:
-batch_mode
Indicates that the cache for category translations should not be flushed. Useful when deleting several categories at once. Don't forget to call reset_translation_cache
Author:
Timo Hentschel <timo@timohentschel.de>

See Also:
 

category::flush_translation_cache (public)

category::flush_translation_cache category_id
Flushes category translation cache of one category.

Parameters:
category_id - category to be flushed.
Author:
Timo Hentschel <timo@timohentschel.de>
 

category::get_children (public)

category::get_children -category_id category_id
Returns the category ids of the direct children of the given category

Switches:
-category_id (required)
category_id
Returns:
list of category ids of the children of the supplied category_id
Author:
Peter Kreuzinger <peter.kreuzinger@wu-wien.ac.at>
 

category::get_data (public)

category::get_data category_id [ locale ]
Gets the category name and the tree name in the specified language, if available. Use default language otherwise.

Parameters:
category_id - category_id to get the names.
locale (optional) - language in which to get the names. [ad_conn locale] used by default.
Returns:
list of category_id, category_name, tree_id and tree_name.
Author:
Timo Hentschel <timo@timohentschel.de>
 

category::get_id (public)

category::get_id name [ locale ]
Gets the id of a category given a name.

Parameters:
name - the name of the category to retrieve
locale (defaults to "en_US") - the locale in which the name is supplied
Returns:
the category id or empty string it no category was found
Author:
Lee Denison <lee@xarg.co.uk>
 

category::get_id_by_object_title (public)

category::get_id_by_object_title title
Gets the id of a category given an object title (object_type=category). This is highly useful as the category object title will not change if you change the name (label) of the category, so you can access the category even if the label has changed

Parameters:
title - object title of the category to retrieve
Returns:
the category id or empty string it no category was found
Author:
Peter Kreuzinger <peter.kreuzinger@wu-wien.ac.at>
 

category::get_mapped_categories (public)

category::get_mapped_categories [ -tree_id tree_id ] object_id
Gets the list of categories mapped to an object. If tree_id is provided return only the categories mapped from the given tree.

Switches:
-tree_id (optional)
Parameters:
object_id - object of which we want to know the mapped categories.
Returns:
tcl-list of category_ids
Author:
Timo Hentschel <timo@timohentschel.de>
 

category::get_mapped_categories_multirow (public)

category::get_mapped_categories_multirow [ -locale locale ] \
    [ -multirow multirow ] object_id
Returns multirow with: tree_id, tree_name, category_id, category_name

Switches:
-locale (optional)
-multirow (defaults to "mapped_categories") (optional)
Parameters:
object_id - object of which we want to know the mapped categories.
Returns:
multirow with tree and category information
Author:
Peter Kreuzinger <peter.kreuzinger@wu-wien.ac.at>
 

category::get_name (public)

category::get_name category_id [ locale ]
Gets the category name in the specified language, if available. Use default language otherwise.

Parameters:
category_id - category_id or list of category_id's for which to get the name.
locale (optional) - language in which to get the name. [ad_conn locale] used by default.
Returns:
list of names corresponding to the list of category_id's supplied.
Author:
Timo Hentschel <timo@timohentschel.de>
 

category::get_names (public)

category::get_names category_ids [ locale ]
Gets the category name in the specified language, if available. Use default language otherwise.

Parameters:
category_ids
locale (optional) - language in which to get the name. [ad_conn locale] used by default.
Returns:
list of names corresponding to the list of category_id's supplied.
Author:
Timo Hentschel <timo@timohentschel.de>
 

category::get_object_context (public)

category::get_object_context object_id
Returns the object name and url to be used in a context bar.

Parameters:
object_id - object_id to get the name of.
Author:
Timo Hentschel <timo@timohentschel.de>
 

category::get_objects (public)

category::get_objects [ -category_id category_id ] \
    [ -object_type object_type ] [ -content_type content_type ] \
    [ -include_children ]
Returns a list of objects which are mapped to this category_id

Switches:
-category_id (optional)
CategoryID of the category we want to get the objects for
-object_type (optional)
Limit the search for objects of this object type
-content_type (optional)
Limit the search for objects of this content_type
-include_children (boolean) (optional)
Include child categories' objects as well. Not yet implemented
Author:
malte ()
Created:
Wed May 30 06:28:25 CEST 2007
 

category::get_parent (public)

category::get_parent -category_id category_id
Returns the category id of the parent category

Switches:
-category_id (required)
category_id
Returns:
category id of the parent category
Author:
Peter Kreuzinger <peter.kreuzinger@wu-wien.ac.at>
 

category::get_tree (public)

category::get_tree category_id
Gets the tree_id of the given category.

Parameters:
category_id - category_id or list of category_id's for which to get the tree_id.
Returns:
tree_id of the tree the category belongs to.
Author:
Timo Hentschel <timo@timohentschel.de>
 

category::indent_html (public, decprecated)

category::indent_html indent_width
Deprecated. Invoking this procedure generates a warning.

Creates a series of   to indent subcatories in html output.

Parameters:
indent_width - width of the html indent.
Author:
Timo Hentschel (timo@timohentschel.de) use string repeat " " $i
 

category::map_object (public)

category::map_object [ -remove_old ] -object_id object_id \
    category_id_list
Map an object to several categories.

Switches:
-remove_old (boolean) (optional)
-object_id (required)
Parameters:
category_id_list - tcl-list of category_ids to be mapped to the object.
Options:
-remove_old
Modifier to be used when categorizing existing objects. Will make sure to delete all old categorizations.
-object_id
object to be categorized.
Author:
Timo Hentschel <timo@timohentschel.de>
 

category::pageurl (public)

category::pageurl object_id
Returns the page that displays a category. To be used by the AcsObject.PageUrl service contract.

Parameters:
object_id - category to be displayed.
Author:
Timo Hentschel <timo@timohentschel.de>
 

category::phase_in (public)

category::phase_in category_id
Marks a category to be visible for categorizing new objects / update existing objects. Make sure to use category_tree::flush_cache afterwards.

Parameters:
category_id - category_id of the category to be phased in
Author:
Timo Hentschel <timo@timohentschel.de>

See Also:
 

category::phase_out (public)

category::phase_out category_id
Marks a category to be phasing out. That means this category and all its subcategories will no longer appear in the categorization widget to categorize new objects / update existing objects, but all existing categorizations will still remain valid. Make sure to use category_tree::flush_cache afterwards.

Parameters:
category_id - category_id of the category to be phased out
Author:
Timo Hentschel <timo@timohentschel.de>

See Also:
 

category::reset_translation_cache (public)

category::reset_translation_cache
Reloads all category translations in the cache.

Author:
Timo Hentschel <timo@timohentschel.de>
 

category::update (public)

category::update -category_id category_id -name name \
    [ -locale locale ] [ -description description ] \
    [ -user_id user_id ] [ -modifying_ip modifying_ip ]
Updates/inserts a category translation.

Switches:
-category_id (required)
-name (required)
-locale (optional)
-description (optional)
-user_id (optional)
-modifying_ip (optional)
Options:
-category_id
category_id of the category to be updated.
-locale
locale of the language. [ad_conn locale] used by default.
-name
category name.
-description
description of the category.
-user_id
user that updates the category. [ad_conn user_id] used by default.
-modifying_ip
ip-address of the user that updates the category. [ad_conn peeraddr] used by default.
Author:
Timo Hentschel <timo@timohentschel.de>