Tree View

Introduction

The tree view displays any array of paths (e.g. '\\a\\b\\c\\d\\', 'a\\b\\b', 'a\\c' etc) in Windows path format (not URL or Linux) as a hierarchy based on the specified style template (or default if nothing is specified).

There are a number of pure CSS style templates that are uploaded with the plugin. These can all be altered to suit your design. There are also a range of other templates available.

The hierachy list has a number of sources that can be specified from S3 structures, file structures, upload folders, plugin folders, page hierarchy or a custom list.

Up to 7 levels of hierarchy can be displayed in any one tree.

End-nodes in the tree can hyperlink to files or other links so it can be used as a navigation tool.

If media files are found as an end-node in a file tree, the image can be included in the tree as an image tile.

This can be combined with the Wolfe Candy Tool Suite for enriched functionality e.g. S3 bucket folder lists and using Private Content shortcode to limit the viewing of tree structures to specified roles.

Installation

Follow the usual Wordpress instructions to install the plugin files. Either copy a ZIP archive of the plugin folder contents into the Word Press plugins folder or install it directly from the Wordpress repositiory.

Additional icon and template sets can also be uploaded as ZIP.

Note: If using tree view with file and folder functionality you will only be able to list or show links to files and structures that the web server has sufficient permissions granted by the underlying file structure to do so. If the web server does not have access then it will not show any node that it does not have access to. If there are no permissions or an incorrect path is passed then the tree may be blank.

Shortcode

The following shortcode command can be inserted into any page, post or widget:

  • [show-tree] displays a tree at the shortcode position. Optional arguments can be included to influence the behaviour of the tree using [show-tree arg1="value1" arg2="value2" ...]

    NB: each tree is associated to a style template* - only 1 style template can be used per page or else they will combine into junk. However - you can have as many trees as you want on a page as long as they use the same style template.

    Usage

    The following arguments can be used in the shortcode or as POST/GET arguments:

  • [tree_source = "'\\a\\b\\c\\d\\', 'a\\b\\b', 'a\\c'"] - any list can be passed in filename format
  • [root = "\\"] - the start point or subfolder from which to display the tree
  • [style_template = "default"] CSS template* to use. If nothing is specified then the "default" template will used.
  • [icon_home = ""] icons** can be specified as icon names or special characters/html entities using &xx; - see the instruction manual on Special Characters
  • [icon_middle = ""]
  • [icon_endpoint = ""]
  • [style_collapse = "true"] the tree is dynamic so that branches can collapse or expand by clicking the node rather than a fixed view of all branches
  • [source = "page-hierarchy"] is the imported source*** of the path list if not manually specified
  • [endpoint_filter=""] // CSV list of matches to include - spaces count in search in format .png,.jpg,.pdf (.png or .jpg or .pdf)
  • [tree_filter=""] CSV list of matches to include - spaces count in search
  • [hidden_filter = "true"] exclude files or folders starting with "."
  • [endpoint_link = "true"]enables the endpoint as a hyperlink if one is set, or false to disallow all links
  • [endpoint_image = "true"] displays an image tile if the endpoint is a media file
  • [endpoint_image_size = "30"] size in pixels of a square image tile

    NB: * More templates can be uploaded but initially the following are available as standard:

  • basic.css
  • boxes.css
  • cabinet.css
  • connected.css
  • default.css
  • elegant.css
  • elegant2.css
  • entity.css
  • hierarchy.css

    NB: ** If the Wolfe Candy Tool Suite is installed then the full icon sets are available to use (and other icon sets are available to download). The following subset is included with this plugin:

  • file-cabinet
  • go-home-8
  • gpicview
  • graph
  • help-contents-5
  • instructions2.jpeg
  • link.gif
  • mail-attach
  • media-player
  • newspaper
  • notepad
  • phone-green
  • post-it-note
  • question_2
  • rating
  • reference
  • smilie
  • user-id
  • view-list-tree-4
  • word.gif

    NB: *** If the Wolfe Candy Tool Suite is installed then more sources are included including S3 buckets and XML documents. The following subset is included with this plugin:

  • plugin-folder displays the contents of the plugin folder - useful for plugin developers
  • uploads-folder displays the contents of the Word Press uploads folder
  • root-folder displays the contents of any path that the system has back-end access to as specified in the root argument
  • manual displays a manual tree source provided using shortcode

    Word Press Developers

    The tree can be called using the class WlfC_Treeview. The following are available methods and arguments:

  • All of the arguments in the Usage section are available e.g. [style_template="template"] is called as $class->style_template="";
  • HTML_out = ""; - stores the result of the BuildTree method
  • style_order = "ul"; or "ol" for numbered list
  • slug = ""; is the plugin name
  • endpoint_link_pattern = "[endpoint_name]"; is the pattern to use to create a hyperlink at each endpoint. Other examples are:
  • endpoint_integration_call = ""; alternative function to call to provide the endpoint_url based on endpoint_name
  • Method AddNodeList($nodes) to manually add items to the list
  • Method BuildTree() returns the HTML and populates HTML_out
  • Method GetNestedNodes($node) returns a distinct array of all list items that match the $node at the next nest_level/sub level
  • Method GetIcon($icon, $isize='s') returns the IMG tag HTML for the specified icon (see icon list above)
  • Method ImportSource($source) imports the path list from a number of different sources
  • Method ListFolder($path) outputs a recursive array of files or folders for a given $path

    Feature Backlog

    Please email wolfecandy@ruralcheshire.co.uk if you would like to see these features (or others) included.

  • Additional icon and template sets
  • Max numbers and/or pagination
  • Color themes as a sortcode argument using XML templates
  • Sort lists
  • List page, post or user hierarchy from Word Press database
  • page-hierarchy displays the site-map which is a hierarchy of pages that make up the Word Press site
  • Build a virtual hierarchy in a database table
  • Allow custom endpoint links through .TRV files or database entries

    The Small Print....

    This plugin software is released under the GPLv2 (or later) GNU General Public License from the Free Software Foundation. Please check restrictions on commercial use or purchase a commercial license.

    Donate if you are able to so that the plugins can be maintained and enhanced - especially if you use it and find it useful! Feature enhancements can be paid for or requested (BTW they are considered high priority when coming from a donator!).If everyone donated just $1 for every download they use, it keeps the development going!

    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 General Public License for more details.

    This plugin comes without support unless the licence or enhanced support is explicitly stated as provided.

    The plugin is installed at the user's own risk. No liability is accepted for any damage to data or any consequential damage whatsoever when using this plugin. In any event this is strictly limited to the annual license fee paid.

    Do not expect the code to be top quality. Much of the designs evolve from MVP and often there is redundant code in the files. Most of the code is commented but isnt always consistent. Some of the functions are not as optimised as they could be or the code as well written or structured as it could be. Some chunks of code are commented out for future use. Tinker with it all at your own peril.

    However the code is written with passion - and it works!

    Please provide honest feedback and ratings so that the plugin user commmunity can grow.

    Any support issues, feature requests or queries can be emailed to wolfecandy@ruralcheshire.co.uk. A response is not guaranteed but our head developer, Jrack Wolfe is keen to hear from you.

    © Copyright Wolfe Candy Creations 2022