Organizational Chart Macro

Last modified by dahin on 2024/07/22 00:02

cogDisplays an organizational chart from list, json or xwiki data.
TypeXAR
Category
Developed by

Ludovic Dubost

Active Installs14
Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager

Description

This macro allows to display an organization chart either from data provided as a wiki list, either from data provided as json, either from the users of the wiki using a "manager" field in the user profile.

To configure the XWiki fields, visit the Macros.OrgChartSetup page.

Credits

This extensions used the orgchart javascript library released under the MIT License by Xuebin Dong

Macro Parameters

 Parameter Name  Description  Possible values  Default value
 source   list, json, xwiki  list if there is a content parameter, xwiki if not 
 content field  wiki list or json to use as data source  see examples  empty
 user  user to start the organizational chart in xwiki source mode any user document (XWiki.ID) If none provided the macro will look for the first user having no manager and being a manager of at least on person
 managerfield  name of the field used to store the manager of a person any users field in the XWiki.XWiki Users class manager
 titlefield  name of the field used to store the title of a person any field in the XWiki.XWikiUsers class title

Simple Organization Chart using an unordered list

{{orgchart}}
* Jef
** John
** Joe
*** Patrick
*** Marie
{{/orgchart}}

orgchart1.png

Simple Organization Chart using json

{{orgchart source="json"}}
  {
      'name': 'Lao Lao',
      'title': 'general manager',
      'children': [
        { 'name': 'Bo Miao', 'title': 'department manager' },
        { 'name': 'Su Miao', 'title': 'department manager',
          'children': [
            { 'name': 'Tie Hua', 'title': 'senior engineer' },
            { 'name': 'Hei Hei', 'title': 'senior engineer',
              'children': [
                { 'name': 'Dan Dan', 'title': 'engineer' }
              ]
            },
            { 'name': 'Pang Pang', 'title': 'senior engineer' }
          ]
        },
        { 'name': 'Hong Miao', 'title': 'department manager' }
      ]
   }
{{/orgchart}}

orgchart2.png

Organization Chart based on XWiki users

For this organization chart to work you need to create a field in the XWiki.XWikiUsers class to hold the manager of a user.
Also you need to provide the top of the organization chart to start with.

{{orgchart source="xwiki" user="XWiki.Admin" managerfield="manager" titlefield="title" /}}

orgchart3.png

XWiki can also find automatically a user that had reporters and no manager to start the tree

{{orgchart /}}

The result will depend on the user profiles in your wiki.

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

Release Notes

v1.0.1

  • Fixed missing webjar dependency

Dependencies

Dependencies for this extension (org.xwiki.contrib:macro-orgchart 1.0.1):

  • org.webjars.npm:orgchart 2.0.4

Get Connected