NAME

HTML::Menu::Hierarchical::ItemInfo - Used by HTML::Menu::Hierarchical.
Provides information about the menu item being processed.

SYNOPSIS

Created by HTML::Menu::Hierarchical objects.

DESCRIPTION

Information holder/gatherer representing one menu item.

METHODS

Getting back information

hasChildren()

Returns true if the current item has child items in the
configuration.  False otherwise.

isSelected()

Returns true if the current item is the selected one.

isInSelectedPath()

Returns true if the current item is in the path from the root of
the hierarchy to the selected item.

getSelectedItem()

Returns the ItemInfo object corresponding to the selected menu
item.

getSelectedLevel()

Returns the level in the hierarchy where the selected menu item
is located.  Levels start at zero.

getMaxDisplayedLevel()

Returns the maximum level in the hierarchy to currently be
displayed.

isOpen()

Returns true if the current menu item is open, i.e., the current
item has child items and is also in the open path.  Return false
otherwise.

isFirstDisplayed()

Returns true if the current menu item is the first one to be
displayed.

isLastDisplayed()

Returns true if the current menu item is the last to be
displayed.

isFirstSiblingDisplayed()

Returns true if the current menu item is the first of its
siblings to be displayed, false otherwise.

isLastSiblingDisplayed()

Returns true if the current menu item is the last of its
siblings to be displayed, false otherwise.

getInfo()

Returns the value of the 'info' field for the current menu item
in the navigation configuration.

Instead of getting the 'info' hash and then accessing a field
within it, you may call a method to get that field directly.
This is implemented with AUTOLOAD, so if you do something like

   my $text = $info_obj->getText;
   my $image_src = $info_obj->getImageSrc;

       or

   my $text = $info_obj->getText;
   my $image_src = $info_obj->get_image_src;

you will be given back the corresponding values in the 'info'
hash.

getName()

Returns the 'name' field for the current menu item in the
navigation configuration.  This is used to determine which menu
item has been selected.

getNextItem()

Returns the ItemInfo object corresponding to the next displayed
menu item.

getPreviousItem()

Returns the ItemInfo object corrsponding to the previously
displayed menu item.

getLevel()

Returns the level in the menu hierarchy where the current menu
item is located.  Levels start at zero.

getParent()

Returns the info object for the current item's parent.

Utilities

my $encoded = $info->urlEncode($plain_text)

URL encodes the given string.  This does full url-encoding, so a
space is %20, not a '+'.

my $query = $info->urlEncodeVars($var_hash)

Takes a hash containing key/value pairs and returns a
url-encoded query string appropriate for adding to the end of a
url.  If a value is an array, it is assumed to be a multivalued
input field and is added to the query string as such.

If you want to encode the query stirng in the new style
recommended by the W3C (use a semicolon as a separator in place
of ampersand), pass a true value for the new_style_url parameter
when creating the HTML::Menu::Hierarchical object.  This will
become the default in a later release.

my $plain_text = $info->urlDecode($url_enc_str)

Decodes the given url-encoded string.

my $var_hash = $info->urlDecodeVars($url_enc_str)

Decodes the url-encoded query string and returns a hash contain
key/value pairs from the query string.  If a field appears more
than once in the query string, it's value will be returned as a
reference to an array of values.

my $modified_url = $info->addArgsToUrl($url, $var_hash)

Takes the key/value pairs in $var_hash and tacks them onto the
end of $url as a query string.

my $html = $info->escapeHtml($text)

Escapes the given text so that it is not interpreted as HTML.

my $text = $info->unescapeHtml($html)

Unescape the escaped text.

There are also underscore_separated versions of these methods.

E.g., unescapeHtml($html) becomes unescape_html($html)

TODO

hasChildrenDisplayed() - tell whether or not the current item's
                         children will be displayed

BUGS

Please send bug reports/feature requests to don@owensnet.com.

AUTHOR

Don Owens <don@owensnet.com>

COPYRIGHT

Copyright (c) 2003 Don Owens

All rights reserved. This program is free software; you can
redistribute it and/or modify it under the same terms as Perl
itself.

VERSION

$Id: ItemInfo.pm,v 1.30 2005/06/16 15:03:00 don Exp $