Tags:
forms1Add my vote for this tag javascript1Add my vote for this tag menu1Add my vote for this tag create new tag
, view all tags

HierarchicalSelectPlugin

Display hierarchical multi-level JavaScript drop-down menus from contents of a TWiki topic

Screenshot

Syntax Rules

Write %HIERARCHICALSELECT{topic="TopicName" [other optional attributes]}% anywhere in a TWiki topic or template.

  • Displays a multi-level drop down menu built from a nested bullet list in another TWiki topic.
  • More than one drop down menu may be used on the same topic. However, a menu (or specific levels from a menu) defined by a specific topic may not be displayed more than once on the same topic - unpredictable things may happen if you try because that is not supported by the software architecture.

Name Description Default
topic topic from which to read the menu definition required
web web from which to read the menu definition current web
key string to use as the basis for naming of HTML form elements derived from menu topic
level if specified, select a menu level (integer starting from 0) to display all levels
parse_keywords flag: nonzero sets parsing mode where first word of menu line is return-value keyword, remainder is text to display entire line used as both return value and display text

Usage Example

This is a multi-level dropdown menu using data from HierarchicalSelectPluginExample. It includes English-speaking countries and state/provincial and regional subdivisions (generally not including levels where municipalities are, though including independent cities), where applicable. Not all have the same levels of depth, even within the same country. The varying depth is really the point of the demo.

The HierarchicalSelectPlugin is not enabled on this TWiki system

Field: Country State/Province/Subdivision County/Region
Entry: %HIERARCHICALSELECT{web="TWiki" topic="HierarchicalSelectPluginExample" level="0" names="country,subdivision,region"}% %HIERARCHICALSELECT{web="TWiki" topic="HierarchicalSelectPluginExample" level="1"}% %HIERARCHICALSELECT{web="TWiki" topic="HierarchicalSelectPluginExample" level="2"}%
Values by level name:

Values by menu name:

1

It is from the following HTML and TML markup:

The HierarchicalSelectPlugin %IF{"context HierarchicalSelectPluginEnabled" then="is" else="is not"}% enabled on this TWiki system

<form action="%SCRIPTURL{view}%/%WEB%/%TOPIC%#UsageExample">
<table cellpadding="5">
<tr><th>
Field:
</th><th>
Country
</th><th>
State/Province/Subdivision
</th><th>
County/Region
</th></tr>
<tr><td>
Entry:
</td><td>
%HIERARCHICALSELECT{web="TWiki" topic="HierarchicalSelectPluginExample" level="0" names="country,subdivision,region"}%
</td><td>
%HIERARCHICALSELECT{web="TWiki" topic="HierarchicalSelectPluginExample" level="1"}%
</td><td>
%HIERARCHICALSELECT{web="TWiki" topic="HierarchicalSelectPluginExample" level="2"}%
</td></tr>
<tr><td>
Values by level name:
</td><td>
%URLPARAM{"country"}%
</td><td>
%URLPARAM{"subdivision"}%
</td><td>
%URLPARAM{"region"}%
</td></tr>
<tr><td>
Values by menu name:
</td><td>
%URLPARAM{"root"}%
</td><td>
%URLPARAM{"%URLPARAM{"root"}%"}%
</td><td>
%URLPARAM{"%URLPARAM{"%URLPARAM{"root"}%"}%"}%
</td></tr>
</table>
<input type="submit" class="twikiSubmit">
</form>

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %HIERARCHICALSELECTPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Display hierarchical multi-level JavaScript drop-down menus from contents of a TWiki topic

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the TWiki server.

  • For an automated installation, run the configure script and follow "Find More Extensions" in the in the Extensions section.

  • Or, follow these manual installation steps:
    • Download the ZIP file from the Plugins home (see below).
    • Unzip HierarchicalSelectPlugin.zip in your twiki installation directory. Content:
      File: Description:
      data/TWiki/HierarchicalSelectPlugin.txt Plugin topic
      data/TWiki/HierarchicalSelectPluginExample.txt Example topic
      data/TWiki/VarHIERARCHICALSELECT.txt Variable documentation topic
      lib/TWiki/Plugins/HierarchicalSelectPlugin.pm Plugin Perl module
      pub/TWiki/Plugins/HierarchicalSelectPlugin/twiki-hierarchicalselect.js JavaScript code
    • Set the ownership of the extracted directories and files to the webserver user.

  • Plugin configuration and testing:
    • Run the configure script and enable the plugin in the Plugins section.
    • Test if the installation was successful: See Usage Example above

Plugin Info

Plugin Author: TWiki:Main.IanKluft
Copyright: © 2010 Twiki Inc
© 2010 TWiki:Main.IanKluft
© 2010-2011 TWiki:TWiki.TWikiContributor
License: GPL (GNU General Public License)
Plugin Version: 2012-12-01
Change History:  
2012-12-01: TWikibug:Item7020: Add category to VarHIERARCHICALSELECT; add screenshot -- TWiki:Main.PeterThoeny
2011-05-01: TWikibug:Item6701: Doc improvements -- TWiki:Main.PeterThoeny
2010-02-20: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.1
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
Benchmarks: GoodStyle nn%, FormattedSearch nn%, HierarchicalSelectPlugin nn%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/HierarchicalSelectPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/HierarchicalSelectPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/HierarchicalSelectPluginAppraisal

Related Topics: HierarchicalSelectPluginExample, VarHIERARCHICALSELECT, TWikiPlugins, DeveloperDocumentationCategory, AdminDocumentationCategory, TWikiPreferences

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatmd5 HierarchicalSelectPlugin.md5 r3 r2 r1 manage 0.2 K 2012-12-02 - 07:44 PeterThoeny  
Compressed Zip archivetgz HierarchicalSelectPlugin.tgz r3 r2 r1 manage 53.0 K 2012-12-02 - 07:43 PeterThoeny  
Compressed Zip archivezip HierarchicalSelectPlugin.zip r3 r2 r1 manage 54.2 K 2012-12-02 - 07:43 PeterThoeny  
Unknown file formatEXT HierarchicalSelectPlugin_installer r2 r1 manage 3.6 K 2012-12-02 - 07:44 PeterThoeny  
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2013-10-16 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2016 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.