HTML::Menu::TreeView - Create a HTML TreeView from scratch
use HTML::Menu::TreeView qw(Tree);
my @tree =( {
text => 'Folder',
subtree => [
{
text => 'treeview Homepage',
href => 'http://lindnerei.sourceforge.net'
}
],
},);
Tree(\@tree);
use HTML::Menu::TreeView;
use strict;
my @tree =(
{
image => 'tar.png',
text => 'Node'
},
);
my $Treeview = new HTML::Menu::TreeView();
print $Treeview->css("/srv/www/httpdocs");
print $Treeview->jscript();
print $Treeview->preload();
print $Treeview->Tree(\@tree);
use HTML::Menu::TreeView qw(css jscript preload Tree);
print css();
print jscript();
print preload();
print Tree(\@tree,"Crystal");
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 desc language
:recommend
Tree css jscript clasic preload folderFirst size Style documentRoot loadTree saveTree sortTree prefix desc
:standart
Tree css jscript preload size Style documentRoot clasic,
:backward
setDocumentRoot getDocumentRoot setSize setClasic setStyle style setModern
:columns
border columns orderByColumn orderBy
HTML::Menu::TreeView is a Modul to build an Html TreeView.
1.18 like 1.17 but at some other places
1.17 #defined @{@$tree[$i]->{subtree}} don't works with perl > 5.20
so try test it with ref @$tree[$i]->{subtree}[0].
1.14 after a few years there a only a few bugfixes.
1.13
Sorting of closed folders will work now.
1.12
some fixes (German umlaute help())
1.10
Overwrought
1.08
delete one unnessesary file.
1.07
Drag & drop example edit.pl
new css class dropzone
Overwrought Documentation
Overwrought Images
1.06
svn moved to http://lindnerei.svn.sourceforge.net/viewvc/lindnerei/treeview/
new Images, german Help
language function set it to "de" for german help
german documentation droped
Build install_examples
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();
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.
set or get the Document Root.
default: this variable is set during make.
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 Document Root if you pass a parameter
return the necessary javascript for preloading images without <script> tag.
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
only for Crystal styles
set or get the size.
16,32,48,64 and 128 are possible values.
set the style in scalar context or get in void context.
Style('simple');
simple = redmond like style.
Crystal = Crystal style (default).
Tree(\@tree,optional $style);
Returns the html part of the Treeview without javasript and css.
enable clasic node decoration:
clasic(1);
disable clasic node decoration:
clasic(0);
return the status in void context.
$status = clasic();
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");
enable border for columns :
border(1);
disable border for columns :
border(0);
return the status in void context.
$status = border();
reverse sorting
enable desc :
desc(1);
disable border:
desc(0);
return the status in void context.
$status = desc();
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();
set the attribute which is used by sortTree and folderFirst.
sort the TreeView by Column
orderByColumn(i);
-1 to disable;
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 used by css.
use this if you want build a offline website
for example:
prefix('.');
return the prefix in void context.
enable mouseover
tr.trOver{}
saveTree('filename',\@ref); # or saveTree()
default: ./TreeViewDump.pl
loadTree('filename') or loadTree()
default: ./TreeViewDump.pl
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'),$/;
if you want german help try
language('de')
URI for linked resource.
accessibility key character.
char encoding of linked resource.
class name or set of class names to an element.
for use with client-side image maps.
the base direction of directionally neutral text.
language code.
the base language of an elements attribute values and text content.
the element lost the focus.
event occurs when the pointing device button is double clicked
event occurs when the pointing device button is clicked over an element.
the element got the focus.
event occurs when a key is pressed down over an element.
event occurs when a key is pressed and released over an element.
event occurs when a key is released over an element.
event occurs when the pointing device button is pressed over an element.
event occurs when the pointing device is moved while it is over an element.
event occurs when the pointing device is moved away from an element.
event occurs when the pointing device is moved onto an element.
event occurs when the pointing device button is released over an element.
forward link types.
reverse link types.
for use with client-side image maps.
specifies style information for the current element.
position in tabbing order.
target frame information.
advisory content type.
element title.
This attribute assigns a name to an element. This name must be unique in a document.
additional text behind the link
an array of TreeView Items
subtree => [{
text => 'Fo'},
{text => 'Bar'}
]
a image name, must be placed into /style/mimetypes directory.
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://lindnerei.sourceforge.net/cgi-bin/crystal.pl for a complete list of possible values for folderclass.
an array of columns
columns => [ 1,2,3,4,5]
set it true if you ant a closed Folder,
which load a location onclick, you must additional set the href attribute.
for backward compatibility.
use documentRoot instead.
use clasic() instead.
for backward compatibility.
use a classic node decoration
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
use clasic() instead.
for backward compatibility.
use a modern node decoration
for backward compatibility.
use size instead.
only for Crystal styles
16,32,48,64 and 128 are possible values.
for backward compatibility.
use style instead.
setStyle('style');
simple = redmond like style
Crystal = Crystal style
set the style.
style('simple');
simple = redmond like style.
Crystal = Crystal style (default).
set the language in scalar context, or get in void context.
language('de');
simple = redmond like style.
Crystal = Crystal style (default).
construct the TreeView called by Tree, new or recursive by appendFolder.
this function is used within initTree for sorting the TreeView if folderFirst(1) is set.
this module 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(@_);
called by initTree(), append a Folder to the treeView()
$self->appendLastFolder(\@tree);
called by initTree() if the last item of the (sub)Tree is a folder.
called by initTree(), append a empty Folder.
$self->appendLastEmptyFolder($node);
called by initTree() if the last item of the (sub)Tree is a folder.
$self->appendNode(\$node);
called by initTree() if the current item of the (sub)Tree is a node.
$self->appendLastNode(\$node);
called by initTree() if the last item of the current (sub)Tree is a node.
http://lindnerei.sourceforge.net
Dirk Lindner <lze@cpan.org>
LGPL
Copyright (C) 2015 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.