Sorted Document Tree Plugin
Creates a hierarchical link list of all pages in the current space |
Type | Plugin |
Category | |
Developed by | xwiki:XWiki.VladimirRiha |
Rating | |
License | GNU Lesser General Public License 2.1 |
Table of contents
Description
Allows to specify the position of each page in the list. In the list there are only pages that are either parents of other pages or children of other pages (so there must be some relationship between them).
How to use it
You need to call one method of the plugin called index() which has 4 parameters.
For example $xwiki.sortedTree.index($doc.space, $context.user,4,0)
- The first parameter specifies the space which is supposed to be searched
- The second parameter specifies the current user (because each user is able to see only pages on which he has "view" rights )
- The third specifies Max depth for searching
- The fourth parameter is used for changing the order of the list
Changing the list order
If you want to have some page higher (or lower...) in the list than others you must specify the page's weight. There are two ways to do that:
- use XWiki class XWiki.TagClass (instances are added to all pages by default)
- or use imported class (section Installation step 3) called XWiki.SortedTreePageClass
Usage of these 2 classes is very similar. If you use TagClass, just add some integer value to the tag attribute. But this attribute must contain only this number. If you use this class for other purposes, you can use SortedTreePageClass. This class has only one attribute called weight. Again, to use it just add an instance of this class to your page and put some integer into the attribute.
Generally, the lower the weight (specify in instance of TagClass or SortedTreePageClass) is, the higher the page in the list is. Common values are between 1 to "infinity" (I recommend 1 to 100). If the page doesn't have weight (or there was a problem with it), then its weight is considered to be 50 (that is the reason I recommend 100 as maximum).
However there are some special values:
- if the weight starts with 0, then child pages are not included in the list, but the parent page is. For example page A has weight 025 and this page has some child page B. Then this page B is not in the list (and also all children of B are not in the list) but page A is included in the list and its weight is considered to be 25
- if the weight is less then 0, then this page is not in the list and also all it's children (and children of them...) are not in the list. So this could be used to exclude some pages from the list
Example
In the page you want to see this list type:
And the result looks like this:
Prerequisites & Installation Instructions
Follow these steps:
- Add the JAR in your container classpath (WEB-INF/lib)
- Edit xwiki.cfg and add the following line to the list of plugins :xwiki.plugins=\
[...]
... ,\
<plugin package> - Restart your container
- Verify the plugin is properly installed by typing the following in a wiki page :{{velocity}}
$xwiki.<plugin name>.name
{{/velocity}}If the installation has been successful, you will see <plugin name>.
For this plugin replace:
- <plugin package> by com.xpn.xwiki.plugin.SortedTree.SortedTree
- <plugin name> by sortedTree