• Publicity: Public Only All

category-list-procs.tcl

Procs for the integration in listbuilder of the site-wide categorization package. Please note: This is highly experimental and is subject to ongoing development so the interfaces might be unstable.

Location:
packages/categories/tcl/category-list-procs.tcl
Created:
17 February 2004
Author:
Timo Hentschel <timo@timohentschel.de>
CVS Identification:
$Id: category-list-procs.tcl,v 1.10.2.1 2019/10/05 13:02:10 gustafn Exp $

Procedures in this file

Detailed information

category::list::collapse_multirow (public)

 category::list::collapse_multirow [ -category_column category_column ] \
    -object_column object_column -name name

Takes a multirow, collapses it so that for each object there's the tcl-list of mapped categories in the category multirow column.

Switches:
-category_column
(defaults to "category_id") (optional)
multirow column name that holds the category_id and will later hold the tcl-list of category_ids
-object_column
(required)
multirow column name that holds the object_id of the categorized object.
-name
(required)
name of the multirow
Author:
Timo Hentschel <timo@timohentschel.de>
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.

category::list::elements (public)

 category::list::elements [ -categories_column categories_column ] \
    [ -tree_ids tree_ids ] [ -locale locale ] [ -one_category_list ] \
    -name name [ spec ]

Adds list-elements to display mapped categories. To be used in list::create.

Scenario:
you prepare a multirow which is then displated via template::list::create

Usage:
you change the list query by adding an outer join to category_object_map and selecting the object_id and the category_id. After having built the multirow holding the list of objects you add a call to

    category::list::collapse_multirow -object_column <<columnname-holding-object_id>> -name <<multirowname>>
to collapse the multirow so that it holds only one row per object with a tcl-list of mapped categories in the category column.

After you got the multirow, use

    category::list::prepare_display -name <<multirowname>> -container_object_id $package_id
(or an object other than package_id that the trees are mapped to). This proc will generate one extra multirow column per mapped tree that will hold a pretty list of the categories. The pretty list can be changed with various options (delimiter, links etc). If you want to have only one extra multirow column holding a pretty list of the mapped trees and categories, then you should use the -one_category_list option.

To automatically generate the appropriate input to be used in the elements section of template::list::create, use

    category::list::elements -name <<multirowname>>
followed by extra spec to be used per element. Again, to display only one column use the -one_category_list option.

Switches:
-categories_column
(defaults to "categories") (optional)
beginning of the names of the multirow columns holding the category-names.
-tree_ids
(optional)
trees to be displayed. if not provided all tree columns in the multirow will be displayed.
-locale
(optional)
locale to display the tree-names in columns.
-one_category_list
(boolean) (optional)
switch to generate only one additional column in the list that holds a pretty list of tree-names and category-names.
-name
(required)
name of the multirow for the list.
Parameters:
spec (optional) - extra spec used for the list-elements. you can override the display_template with using "categories" as column holding the pretty list of category-names.
Author:
Timo Hentschel <timo@timohentschel.de>
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 category_tree::get_name category_tree::get_name (public) template::multirow template::multirow (public) category::list::elements category::list::elements category::list::elements->category_tree::get_name category::list::elements->template::multirow

Testcases:
No testcase defined.

category::list::get_pretty_list (public)

 category::list::get_pretty_list \
    [ -category_delimiter category_delimiter ] \
    [ -category_link category_link ] \
    [ -category_link_eval category_link_eval ] \
    [ -category_link_html category_link_html ] \
    [ -remove_link remove_link ] \
    [ -remove_link_eval remove_link_eval ] \
    [ -remove_link_text remove_link_text ] \
    [ -tree_delimiter tree_delimiter ] [ -tree_colon tree_colon ] \
    [ -tree_link tree_link ] [ -tree_link_eval tree_link_eval ] \
    [ -tree_link_html tree_link_html ] \
    [ -category_varname category_varname ] \
    [ -tree_varname tree_varname ] [ -uplevel uplevel ] \
    category_id_list [ locale ]

Accepts a list of category_ids and returns a pretty list of tree-names and category-names with optional links for each tree and category.

Switches:
-category_delimiter
(defaults to ", ") (optional)
string that separates the categories in the pretty list
-category_link
(optional)
optional link for every category-name
-category_link_eval
(optional)
optional command that returns the link for every category-name. normally this would be a export_vars command that could contain __category_id and __tree_id which refer to category_id and tree_id of the category-name the link will wrap.
-category_link_html
(optional)
optional list of key value pairs for additional html in a link.
-remove_link
(optional)
-remove_link_eval
(optional)
-remove_link_text
(optional)
-tree_delimiter
(defaults to "; ") (optional)
string that separates the tree-names in the pretty list
-tree_colon
(defaults to ": ") (optional)
string that separates a tree-name from the category-names in that tree.
-tree_link
(optional)
optional link for every tree-name
-tree_link_eval
(optional)
optional command that returns the link for every tree-name. normally this would be a export_vars command that could contain __tree_id which refer to tree_id of the tree-name the link will wrap.
-tree_link_html
(optional)
optional list of key value pairs for additional html in a link.
-category_varname
(defaults to "__category_id") (optional)
name of the variable that will hold the category_id for category link generation.
-tree_varname
(defaults to "__tree_id") (optional)
name of the variable that will hold the tree_id for category and tree link generation.
-uplevel
(defaults to "1") (optional)
upvar level to set __tree_id and __category_id for link generation.
Parameters:
category_id_list - tcl-list of categories to display.
locale (optional) - locale of the category-names and tree-names.
Returns:
pretty list of tree-names and category-names
Author:
Timo Hentschel <timo@timohentschel.de>
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 category::list::prepare_display category::list::prepare_display (public) category::list::get_pretty_list category::list::get_pretty_list category::list::prepare_display->category::list::get_pretty_list packages/categories/lib/categorize.tcl packages/categories/ lib/categorize.tcl packages/categories/lib/categorize.tcl->category::list::get_pretty_list category::get_data category::get_data (public) category::list::get_pretty_list->category::get_data

Testcases:
No testcase defined.

category::list::prepare_display (public)

 category::list::prepare_display \
    [ -category_delimiter category_delimiter ] \
    [ -category_link category_link ] \
    [ -category_link_eval category_link_eval ] \
    [ -category_link_html category_link_html ] \
    [ -tree_delimiter tree_delimiter ] [ -tree_colon tree_colon ] \
    [ -tree_link tree_link ] [ -tree_link_eval tree_link_eval ] \
    [ -tree_link_html tree_link_html ] \
    [ -category_varname category_varname ] \
    [ -tree_varname tree_varname ] \
    [ -category_column category_column ] \
    [ -categories_column categories_column ] [ -tree_ids tree_ids ] \
    [ -exclude_tree_ids exclude_tree_ids ] \
    [ -container_object_id container_object_id ] [ -locale locale ] \
    [ -one_category_list ] -name name

Extends a given multirow with either one extra column holding a pretty list of the tree-names and category-names or one column per tree holding a pretty list of category-names. These extra column can then be used in the listbuilder to display a pretty list of categorized objects.

Switches:
-category_delimiter
(defaults to ", ") (optional)
string that separates the categories in the pretty list
-category_link
(optional)
optional link for every category-name
-category_link_eval
(optional)
optional command that returns the link for every category-name. normally this would be a export_vars command that could contain __category_id and __tree_id which refer to category_id and tree_id of the category-name the link will wrap.
-category_link_html
(optional)
optional list of key value pairs for additional html in a link.
-tree_delimiter
(defaults to "; ") (optional)
string that separates the tree-names in the pretty list
-tree_colon
(defaults to ": ") (optional)
string that separates a tree-name from the category-names in that tree.
-tree_link
(optional)
optional link for every tree-name
-tree_link_eval
(optional)
optional command that returns the link for every tree-name. normally this would be a export_vars command that could contain __tree_id which refer to tree_id of the tree-name the link will wrap.
-tree_link_html
(optional)
optional list of key value pairs for additional html in a link.
-category_varname
(defaults to "__category_id") (optional)
name of the variable that will hold the category_id for category link generation.
-tree_varname
(defaults to "__tree_id") (optional)
name of the variable that will hold the tree_id for category and tree link generation.
-category_column
(defaults to "category_id") (optional)
name of the column in the multirow holding the tcl-list of mapped categories.
-categories_column
(defaults to "categories") (optional)
beginning of the names of the multirow columns holding the category names.
-tree_ids
(optional)
tcl-list of trees that should be displayed.
-exclude_tree_ids
(optional)
tcl-list of trees that should not be displayed.
-container_object_id
(optional)
object the trees are mapped to (instead of providing tree_ids).
-locale
(optional)
locale of the category-names and tree-names.
-one_category_list
(boolean) (optional)
switch to generate only one additional column in the multirow that holds a pretty list of tree-names and category-names.
-name
(required)
name of the multirow to extend.
Author:
Timo Hentschel <timo@timohentschel.de>
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 category::get_name category::get_name (public) category::get_tree category::get_tree (public) category::list::get_pretty_list category::list::get_pretty_list (public) category_tree::get_mapped_trees category_tree::get_mapped_trees (public) template::multirow template::multirow (public) category::list::prepare_display category::list::prepare_display category::list::prepare_display->category::get_name category::list::prepare_display->category::get_tree category::list::prepare_display->category::list::get_pretty_list category::list::prepare_display->category_tree::get_mapped_trees category::list::prepare_display->template::multirow

Testcases:
No testcase defined.

category::list::rewrite_query (public)

 category::list::rewrite_query -object_column object_column \
    [ -category_column category_column ] [ -dbn dbn ] sql

Takes a sql-query and adds an outer join to category_object_map

Switches:
-object_column
(required)
column name that holds the object_id of the categorized object.
-category_column
(defaults to "category_id") (optional)
column name of the mapped category_id.
-dbn
(optional)
Parameters:
sql - sql-query to be rewritten
Author:
Timo Hentschel <timo@timohentschel.de>
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 db_driverkey db_driverkey (public) category::list::rewrite_query category::list::rewrite_query category::list::rewrite_query->db_driverkey

Testcases:
No testcase defined.
[ show source ]