NAME
HTML::Menu::TreeView - Create a HTML TreeView from scratch
SYNOPSIS
use HTML::Menu::TreeView qw(Tree);
my @tree =( {
text => 'Folder',
subtree => [
{
text => 'treeview Homepage',
href => 'http://treeview.lindnerei.de',
}
],
},);
Tree(\@tree);
OO Syntax
use HTML::Menu::TreeView;
use strict;
my @tree =(
{
image => 'tar.png',
onclick => "alert('onclick');",
text => 'Node',
},
{
text => 'Folder',
folderclass => 'folderMan', # only for Crystal styles
subtree => [
{
text => 'Cpan',
href => 'http://cpan.org',
},
],
},
);
my $Treeview = new HTML::Menu::TreeView();
print $Treeview->css("/srv/www/httpdocs");
print $Treeview->jscript();
print $Treeview->preload();
print $Treeview->Tree(\@tree);
FO Syntax
use HTML::Menu::TreeView qw(:all);
print css();
print jscript();
print preload();
print Tree(\@tree,"Crystal");
function sets
Here is a list of the function sets you can import:
:all
Tree css jscript clasic preload help folderFirst size documentRoot loadTree saveTree sortTree orderBy prefix Style orderByColumn border
:recommend
Tree css jscript clasic preload folderFirst size Style documentRoot loadTree saveTree sortTree orderBy prefix
:standart
Tree css jscript preload size Style documentRoot clasic,
:backward
setDocumentRoot getDocumentRoot setSize setClasic setStyle style setModern %anker
:columns
border columns orderByColumn
DESCRIPTION
HTML::Menu::TreeView is a Modul to build an Html TreeView.
Changes
1.04
TrOver enable mouseover for rows tr.trOver{}
1.03
Change Charset to ISO 8859-1 (HTML::Menu::TreeView::GER)
Background-position Crystal 16px style.
Fix Required Perl Version. it is 5.00600
Public
new
if you use the oo interface you can say:
my $TreeView = new HTML::Menu::TreeView(\@tree, optional style);
and then call Tree without arguments.
print $TreeView->Tree();
css
return the necessary css part without <style></style> tag.
you can set the DocumentRoot if you pass a parameter
css('/document/root/');
You can also include it with
<link href="/style/Crystal/16/html-menu-treeview/Crystal.css" rel="stylesheet" type="text/css">
for example.
documentRoot
set the Document Root in scalar context, or get it in void context.
default: this variable is set during make.
jscript
return the necessary javascript without <script> tag.
You can also include it with:
<script language="JavaScript" type="text/javascript" src="/style/treeview.js"></script>
you can set the DocumentRoot if you pass a parameter
preload
return the necessary javascript for preloading images without <script> tag.
for example you can also include it with
<script language="JavaScript" type="text/javascript" src="/style/Crystal/16/html-menu-treeview/preload.js"></script>
or
<script language="JavaScript" type="text/javascript" src="/style/Crystal/preload.js"></script>
if you use different images sizes.
you can set the DocumentRoot if you pass a parameter
size
only for Crystal styles
set the size in scalar context, or get in void context.
16,32,48,64 and 128 are possible values.
Style
set the style in scalar context or get in void context.
Style('simple');
simple = redmond like style.
Crystal = Crystal style (default).
Tree
Tree(\@tree,optional $style);
Returns the html part of the Treeview without javasript and css.
clasic
enable clasic node decoration:
clasic(1);
disable clasic node decoration:
clasic(0);
return the status in void context.
$status = clasic();
columns
set number of columns
columns(3);
return the count in void context.
$count = columns();
or set the captions for the columns
columns("Name","Column 1","Column 2","Column 3");
border
enable border for columns :
border(1);
disable border for columns :
border(0);
return the status in void context.
$status = border();
sortTree
set or unset sorting treeview Items.
default is false.
enable sorting:
sortTree(1);
disable sorting:
sortTree(0);
return the status in void context.
$status = sortTree();
orderBy
set the attribute which is used by sortTree and folderFirst.
orderByColumn
sort the TreeView by Column
orderByColumn(i)
folderFirst
set or unset show folders first ?
default is false.
enable show folders first:
folderFirst(1);
disable show folders first:
folderFirst(0);
return the status of this property in void context.
$status = folderFirst();
prefix
prefix used by css.
use this if you want build a offline website
for example:
prefix('.');
return the prefix in void context.
TrOver
enable mouseover
tr.trOver{}
saveTree
saveTree('filename',\@ref); # or saveTree()
default: ./TreeViewDump.pl
loadTree
loadTree('filename') or loadTree()
default: ./TreeViewDump.pl
help
help for link attributes.
return a hashref in void context,
my $hashref = help();
foreach my $key (sort(keys %{$hashref})){
print "$key : ", $hashref->{$key} ,$/;
}
or a help Message.
print help('href'),$/;
reserved attributes:
- href
-
URI for linked resource.
- accesskey
-
accessibility key character.
- charset
-
char encoding of linked resource.
- class
-
class name or set of class names to an element.
- coords
-
for use with client-side image maps.
- dir
-
the base direction of directionally neutral text.
- hreflang
-
language code.
- lang
-
the base language of an elements attribute values and text content.
- onblur
-
the element lost the focus.
- ondblclick
-
event occurs when the pointing device button is double clicked
- onclick
-
event occurs when the pointing device button is clicked over an element.
- onfocus
-
the element got the focus.
- onkeydown
-
event occurs when a key is pressed down over an element.
- onkeypress
-
event occurs when a key is pressed and released over an element.
- onkeyup
-
event occurs when a key is released over an element.
- onmousedown
-
event occurs when the pointing device button is pressed over an element.
- onmousemove
-
event occurs when the pointing device is moved while it is over an element.
- onmouseout
-
event occurs when the pointing device is moved away from an element.
- onmouseover
-
event occurs when the pointing device is moved onto an element.
- onmouseup
-
event occurs when the pointing device button is released over an element.
- rel
-
forward link types.
- rev
-
reverse link types.
- shape
-
for use with client-side image maps.
- style
-
specifies style information for the current element.
- tabindex
-
position in tabbing order.
- target
-
target frame information.
- type
-
advisory content type.
- title
-
element title.
- id
-
This attribute assigns a name to an element. This name must be unique in a document.
- addition
-
additional text behind the link
- subtree
-
an array of TreeView Items
subtree => [{ text => 'Fo'}, {text => 'Bar'} ]
- image.
-
a image name, must be placed into /style/mimetypes directory.
- folderclass :
-
only for Crystal styles
possible values:
folderMan, folderVideo,folderCrystal,
folderLocked , folderText, folderFavorite,
folderPrint,folderHtml,
folderImage,folderSound,folderImportant,
folderTar,folderYellow ,folderGray,
folderGreen and folderRed
see http://treeview.lindnerei.de/cgi-bin/crystal.pl for a complete list of possible values for folderclass.
- columns
-
an array of columns
columns => [ 1,2,3,4,5]
- empty.
-
set it true if you ant a closed Folder,
which load a location onclick, you must additional set the href attribute.
backward compatibility
getDocumentRoot
for backward compatibility.
use documentRoot instead.
setClasic
use clasic() instead.
for backward compatibility.
use a classic node decoration
setDocumentRoot
for backward compatibility.
use documentRoot instead.
set the local path to the style folder.
should be the Document Root of your webserver.
example:
setDocumentRoot('/sv/www/htdocs/');
default: this property is set during make
setModern
use clasic() instead.
for backward compatibility.
use a modern node decoration
setSize
for backward compatibility.
use size instead.
only for Crystal styles
16,32,48,64 and 128 are possible values.
setStyle
for backward compatibility.
use style instead.
setStyle('style');
simple = redmond like style
Crystal = Crystal style
style
set the style in scalar context, or get in void context.
style('simple');
simple = redmond like style.
Crystal = Crystal style (default).
Private
initTree
construct the TreeView called by Tree, new or recursive by appendFolder.
_ffolderFirst
this function is used within initTree for sorting the TreeView if folderFirst(1) is set.
getSelf
HTML::Menu::TreeView Module make use of a Lincoln loader like class system.
if the first parameter is a HTML::Menu::TreeView object (oo syntax ) this function returns the given parameters.
or the first parameter it is not a object referenz (fo syntax) it create a new HTML::Menu::TreeView object,
return it as first value and @_ as the second value .
my ($self, @p) = getSelf(@_);
appendFolder
called by initTree(), append a Folder to the treeView()
appendLastFolder
$self->appendLastFolder(\@tree);
called by initTree() if the last item of the (sub)Tree is a folder.
appendEmptyFolder
called by initTree(), append a empty Folder.
appendLastEmptyFolder
$self->appendLastEmptyFolder($node);
called by initTree() if the last item of the (sub)Tree is a folder.
appendNode
$self->appendLastNode(\$node);
called by initTree() if the current item of the (sub)Tree is a node.
appendLastNode
$self->appendLastNode(\$node);
called by initTree() if the last item of the current (sub)Tree is a node.
SEE ALSO
http://www.lindnerei.de, http://treeview.lindnerei.de,
HTML::Menu::TreeView::GER, http://treeview.tigris.org,
AUTHOR
Dirk Lindner <lze@cpan.org>
LICENSE
LGPL
Copyright (C) 2008 by Hr. Dirk Lindner
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.