Changes between Version 11 and Version 12 of MenusPlugin

Dec 17, 2008, 12:06:51 PM (9 years ago)



  • MenusPlugin

    v11 v12  
    2121Download the [download:menusplugin zipped source], check out MenusPlugin from [/svn/menusplugin using Subversion], or [source:menusplugin browse the source] with Trac.
     23== Configuration ==
     24As usual, configuration takes place in the `trac.ini` file. Most interesting things first - they are to be found in the `[mainnav]` section: Here you set up your menu items. Syntax is: `<item_name>.<property> = <value>` - where `<item_name>` is either the already existing handler (e.g. "wiki" for the wiki item, "tickets" for the tickets, "newticket" for the "New Ticket" item, a.s.o.) - or a term which ''must not exist'' for a brand new item to be introduced (as e.g. the "Team Tools" in the [#Example Examples] section). A special case is e.g. `top` to make a new item appearing on top level.
     26=== Defining your menus in the `[mainnav]` section ===
     27So here come the available properties and their possible values:
     28||'''Property'''||'''Description'''||'''Example value'''||
     29||parent||Make the item a sub-item to the one mentioned as value||top||
     30||label||What should be written on the "button"||Team Tools||
     31||href||Where the item should link to||/report/1||
     32||enabled||Should it be used? Hell, why we define it? But this is useful to temporarily disable an item.||1||
     33||hide_if_disabled||Useful if you move an existing top-level element: Don't display anything if it is not existing (otherwise, <item_name> would be displayed if the user lacks the permission). Works only for components.||1||
     34||hide_if_no_children||Don't display this (sub) menu if it has no children (e.g. the current user lacks the privileges for all sub-items)||1||
     35||perm||For items like reports, `hide_if_disabled` does not work, since this is no component. Though, it should not be displayed if it is not available. So you can handle this by defining the required permission.||REPORT_VIEW||
     36||order||Move an item to the left/right. By default, all items have an order of 999 (who will ever reach 999 items must have done something wrong, really!). Use values from 1..999 to define positions. Use a negative value for an item you want to make sure it always comes first - and a value larger than 999 if it sould always come last.||5||
     37||path_info||To be matched with the request path info.||??||
     39,,Missing here: `inherit`,,
     41=== Defining the behaviour in the `[menu-custom]` section ===
     42Here you can (re-)define (i.e. customize) the behavior of MenusPlugin. Usually, you won't need that - since the defaults are fine. But in case you need a toy to play with - here we go:
     44Syntax is quite easy, it's just `<option> = <value>`. Available options are:
     46||managed_menus||Which menus should be maintained by the plugin.||mainnav,metanav||
     47||serve_ui_files||Whether the required UI files (i.e. `*.js` and `*.css` files) should be linked into the page. Boolean value.||1||
     49The `serve_ui_files` option you will only need to override if you want to apply your own styles and need to suppress the original ones for this. Rare case - but who knows?
    2351== Example ==
    4371worklog.hide_if_disabled = 1
    4472# Add more things...
    45 #...
    4775# rename "Browse Source" to "Code"
    5382# this is no component - so to hide it if not available, we need a trick
     103# Make sure the Wiki is always the first item - and Admin always the last:
     104wiki.order = -999999
     105admin.order = 999999