- NAME
- DESCRIPTION
- METHODS
  - TraversePrePost PREFUNC POSTFUNC
  - GetReferencedQueues
  - GetReferencedCatalogs
  - GetQueryAndOptionList SELECTED_NODES
  - PruneChildLessAggregators
  - GetDisplayedNodes

# NAME

      RT::Interface::Web::QueryBuilder::Tree - subclass of Tree::Simple used in Query Builder

# DESCRIPTION

This class provides support functionality for the Query Builder (Search/Build.html). It is a subclass of Tree::Simple.

# METHODS

## TraversePrePost PREFUNC POSTFUNC

Traverses the tree depth-first. Before processing the node's children, calls PREFUNC with the node as its argument; after processing all of the children, calls POSTFUNC with the node as its argument.

(Note that unlike Tree::Simple's `traverse`, it actually calls its functions on the root node passed to it.)

## GetReferencedQueues

Returns a hash reference; each queue referenced with an '=' operation will appear as a key whose value is 1.

## GetReferencedCatalogs

Returns a hash reference; each catalog referenced with an '=' operation will appear as a key whose value is 1.

## GetQueryAndOptionList SELECTED_NODES

Given an array reference of tree nodes that have been selected by the user, traverses the tree and returns the equivalent SQL query and a list of hashes representing the "clauses" select option list. Each has contains the keys TEXT, INDEX, SELECTED, and DEPTH. TEXT is the displayed text of the option (including parentheses, not including indentation); INDEX is the 0-based index of the option in the list (also used as its CGI parameter); SELECTED is either 'SELECTED' or '', depending on whether the node corresponding to the select option was in the SELECTED_NODES list; and DEPTH is the level of indentation for the option.

## PruneChildLessAggregators

If tree manipulation has left it in a state where there are ANDs, ORs, or parenthesizations with no children, get rid of them.

## GetDisplayedNodes

This function returns a list of the nodes of the tree in depth-first order which correspond to options in the "clauses" multi-select box. In fact, it's all of them but the root and its child.

← Back to index