Tree Browser Plugin
Renders a bulleted or numbered list as a collapsable/expandable tree of nodes.
Acknowledgement
This plugin leverages the dTree JavaScript tree menu by Geir Landrö as well as code borrowed from TWiki:Plugins.RenderListPlugin.
Syntax Rules
Place the tag %TREEBROWSER{ parameters }% immediately before a bulleted or numbered list. The lists can be handcrafted, generated by another Plugin, a %TOC%, or the result of a FormattedSearch. The list will be rendered in a tree-like fashion (similar to the explorer folder list). Whenever a new indentation level is started, the subsequent nodes at this or a lower indentation level are shown as descendents of the preceding node. The following parameters can be used to configure the appearance of the tree:
| Parameter | Description | Default |
"name" or theme="name" | Select a rendering theme | none |
title | Required. This text serves as the root of the tree | none |
openAll | If on, the tree is shown fully expanded. | off |
openTo | Must be an integer. If present, the tree is expanded to the given node, as numbered from the root. | 0 |
shared | Must be a string. If present, the state of the tree is shared across all trees using this string. For example, if the tree is used in the WebLeftBar, the state will hold at all topics with this WebLeftBar. It's basically the name of the JavaScript? object representing your tree. | none |
uselines | Set to false if you don't want to show lines linking nodes and leafs in the tree | true |
useplusminus | Set to false if you don't want to show '-' and '+' signs. One can use something like onclick='javascript: tree.o($index);' in the tree item to trigger opening/closing of a node. | true |
noindent | Set to true to show children at the level their parent. It suppresses children indentation. | false |
nocss | Set to true to prevent inclusion of dtree.css. | false |
closesamelevel | If true only one node within a parent can be expanded at the same time. openAll() and closeAll() functions do not work when this is enabled. | false |
Rendering themes can be defined by <name>_THEME Plugin settings
- Each theme is defined by a comma separated list containing the render type and parameters required by that render type
- There are different render types; currently this Plugin supports tree and icon render types
- Format of the tree render type:
-
Set < name >_THEME = tree
- Format of the icon render type:
-
Set < name >_THEME = icon, [< root icon image >], [< icon image >], [< folder icon image >], [< open folder icon image >]
- The root icon image is shown at the root of the tree, the icon image is shown at every leaf node, the folder icon image is shown at every collapsed internal node, and the open folder icon image is shown at every expanded internal node. The icon images point to files attached to TWiki topics and are referenced in the standard manner. If no path is given, the images are taken from TWikiDocGraphics.
- If an icon image is omitted, the following defaults are chosen:
, , ,
If JavaScript is not enabled, the list is rendered as usual, and the =%TREEBROWSER% tag is omitted.
Bullets
- Use regular
* bullets
- Start with level one
- Increase indentation only one level at a time
- Decreasing indentation many levels at a time is fine
- Keep labels short as text does not wrap.
- You can specify an icon for a bullet of render type tree or icon:
- Attach the icon to a topic, e.g.
myicon.gif, or
- Use one of the existing icons:
%ATTACHURL%/globe.gif, %ATTACHURL%/home.gif, %ATTACHURL%/virtualhome.gif, %ATTACHURL%/group.gif, %ATTACHURL%/persons.gif, virtualpersons.gif, %ATTACHURL%/person.gif, %ATTACHURL%/virtualperson.gif, %ATTACHURL%/email.gif, %ATTACHURL%/trend.gif, %ATTACHURL%/folder.gif, %ATTACHURL%/file.gif, %ATTACHURL%/doc.gif, %ATTACHURL%/image.gif, %ATTACHURL%/pdf.gif, %ATTACHURL%/ppt.gif, %ATTACHURL%/sound.gif, %ATTACHURL%/xls.gif, %ATTACHURL%/zip.gif, %ATTACHURL%/see.gif
- Refer to an attached icon at the beginning of the bullet with:
-
icon:myicon.gif Followed by normal bullet text
Example
%TREEBROWSER{"file" title="[[%HOMETOPIC%][%INCLUDINGWEB% Web Home]]" shared="left"}%
* [[WebChanges][Changes]]
* [[WebIndex][Index]]
* [[WebSearch][Search]]
* this is a very very very long text
* *Webs*
%WEBLIST{" * [[$name.%HOMETOPIC%][$name]]"}%
generates
This tree could be used in the WebLeftBar, for example. Clicking on the plus icon next to Webs will expand the subtree below that node.
To add "collapse/expand all nodes" functionalities do something like:
<a href="javascript: tree.openAll();">open all</a> | <a href="javascript: tree.closeAll();">close all</a>
%TREEBROWSER{"file" title="[[%HOMETOPIC%][%INCLUDINGWEB% Web Home]]" shared="tree"}%
...
Plugin Settings
Plugin settings are stored as preferences variables. To reference
a plugin setting write %<plugin>_<setting>%, i.e. %TREEBROWSERPLUGIN_SHORTDESCRIPTION%
- One line description, is shown in the TextFormattingRules topic:
- Set SHORTDESCRIPTION = Renders a list as a collapsable/expandable tree.
- Debug plugin: (See output in
data/debug.txt)
- Themes are named
<SOMETHING>_THEME and contain a comma delimited list of render type with parameters:
- Set THREAD_THEME = tree
- Set HOME_THEME = icon,
- Set ORG_THEME = icon,
, , ,
- Set GROUP_THEME = icon, tip.gif,
, ,
- Set EMAIL_THEME = icon,
- Set TREND_THEME = icon,
- Set FILE_THEME = icon,
- Set DIR_THEME = icon,
- Set FORUM_THEME = icon, group.gif, index.gif, indexlist.gif, indexlist.gif
Plugin Installation Instructions
- Download the zip file.
- Unzip
TreeBrowserPlugin.zip in your twiki installation directory. Content: | File: | Description: | data/TWiki/TreeBrowserPlugin.txt | Plugin topic | lib/TWiki/Plugins/TreeBrowserPlugin.pm | Plugin Perl module | pub/TWiki/TreeBrowserPlugin/dtree.css | part of dtree | pub/TWiki/TreeBrowserPlugin/dtree.js | part of dtree | pub/TWiki/TreeBrowserPlugin/base.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/cd.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/empty.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/folder.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/folderopen.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/globe.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/imgfolder.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/join.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/joinbottom.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/line.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/minus.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/minusbottom.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/musicfolder.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/nolines_minus.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/nolines_plus.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/page.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/plus.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/plusbottom.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/question.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/trash.gif | part of dtree | pub/TWiki/TreeBrowserPlugin/doc.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/email.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/file.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/group.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/home.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/image.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/pdf.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/person.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/persons.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/ppt.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/see.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/sound.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/trend.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/virtualhome.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/virtualperson.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/virtualpersons.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/xls.gif | icons from RenderListPlugin | pub/TWiki/TreeBrowserPlugin/zip.gif | icons from RenderListPlugin |
Planned Enhancements
- Support configurable icons for each node (similar to TWiki:Plugins.RenderListPlugin). SL: Sounds fun!
- Support configurable default icons. SL: I think this was done sometimes ago.
- Support wrapping of long node text. SL: Not sure how to do that? Looks like it's not such a big problem with Firfox.
- Support tree browser in other than view mode also. SL: Not sure what's that?
- Cleanup and comment JavaScript code.
Plugin Info
Related Topics: TWiki:Plugins.RenderListPlugin
-- TWiki:Main.ThomasWeigert - 16 Sep 2005
|
| | Attachment | Action | Size | Date | Who | Comment |
| base.gif | props, move | 1.0 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| cd.gif | props, move | 0.2 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| doc.gif | props, move | 0.9 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| dtree.css | props, move | 0.8 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| dtree.css~ | props, move | 0.8 K | 28 Sep 2006 - 01:14 | UnknownUser | |
| dtree.js | props, move | 12.1 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| dtree.js~ | props, move | 12.1 K | 01 Oct 2006 - 00:52 | UnknownUser | |
| email.gif | props, move | 0.2 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| empty.gif | props, move | 0.1 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| file.gif | props, move | 0.1 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| folder.gif | props, move | 0.4 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| folderopen.gif | props, move | 0.4 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| globe.gif | props, move | 1.1 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| group.gif | props, move | 0.2 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| home.gif | props, move | 0.2 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| image.gif | props, move | 0.9 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| imgfolder.gif | props, move | 0.6 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| join.gif | props, move | 0.1 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| joinbottom.gif | props, move | 0.1 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| line.gif | props, move | 0.1 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| minus.gif | props, move | 0.1 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| minusbottom.gif | props, move | 0.1 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| musicfolder.gif | props, move | 0.6 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| nolines_minus.gif | props, move | 0.8 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| nolines_plus.gif | props, move | 0.8 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| page.gif | props, move | 0.6 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| pdf.gif | props, move | 0.9 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| person.gif | props, move | 0.1 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| persons.gif | props, move | 0.2 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| plus.gif | props, move | 0.1 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| plusbottom.gif | props, move | 0.1 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| ppt.gif | props, move | 0.9 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| question.gif | props, move | 1.0 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| see.gif | props, move | 0.1 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| sound.gif | props, move | 0.2 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| trash.gif | props, move | 1.0 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| tree.jpg | props, move | 7.9 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| trend.gif | props, move | 0.1 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| virtualhome.gif | props, move | 0.2 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| virtualperson.gif | props, move | 0.1 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| virtualpersons.gif | props, move | 0.2 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| xls.gif | props, move | 0.9 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
| zip.gif | props, move | 0.9 K | 01 Oct 2006 - 21:46 | TWikiAdminGroup | Saved by install script |
|
 Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors. Ideas, requests, problems regarding SmartAgency? Send feedback Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TreeBrowserPlugin
|
|