Extension:JSWikiGantt

Category:Extensions incompatible with 1.39 Category:Unmaintained extensions#JSWikiGantt Category:Extensions without a compatibility policyCategory:BSD licensed extensions
MediaWiki extensions manual
JSWikiGantt
Release status: unmaintainedCategory:Unmaintained extensions
Implementation Tag Category:Tag extensions
Description Draws Gantt charts inside wiki articles.
Author(s) Extension code and fixes by Maciej "Nux" Jaros,

JSGantt by Shlomy Gantz,

Xaprb JavaScript date formatting by Baron Schwartz
Latest version 0.7.0 (2023-04-16)
MediaWiki Category:Extensions without MediaWiki version
License BSD 2-clause "Simplified" License
Download Category:Extensions in GitHub version control
"$wgJSGanttConfig" (see "JSWikiGantt.config.php" for details)
<jsgantt>
Category:All extensionsCategory:Extensions not in ExtensionJson

The JSWikiGantt extension aims to allow adding Gantt charts (diagrams) to wiki pages without exporting diagrams to PNG.

This is achieved by allowing users to add simple XML definitions of diagrams in <jsgantt> tag. Currently, only one diagram per page is allowed (which is due to the limitations of the original JSGantt).

This extension is based on JSGantt project started by Shlomy Gantz and Xaprb JavaScript date formatting by Baron Schwartz. See jsgantt.js and date-functions.js for details on licensing these modules.

Usage

To add a diagram to a page, add a <jsgantt> tag with <task> tags inside it (described below).

The <jsgantt> tag can have only one attribute:

autolink
if set to 1, your tasks will be automatically linked based on the task ID (useful if you use task IDs from your bug tracking software). Remember to set $wgJSGanttConfig['TasksAutoLink'] in JSWikiGantt.config.php if you use this. The default state of auto-linking is set with the $wgJSGanttConfig['AutoLinks'] variable.

Tasks tags

Tags that can be used inside the <task> tag are described below.

Tag namerequired?example value description
pIDyes10 a task id
pNameyesHeal the world a task name/title
pStartyes/no2011-01-01 ISO style date when this task should be started; not required for groups
pEndyes/no2011-12-31 ISO style date when this task should end; not required for groups
pColoryes00FF00 a color of this task on a diagram (the color of a bar that is on the right side of a diagram)
pLinkno http://world.peace/for-dummies URL that can e.g., point to a description of a task (omit if you use auto links to e.g. point to your bugzilla/flyspray or whatever bug killer you use)
pMileno0 milestone number
pResnoMr. Healer resource name (e.g., developer that is assigned to this task)
pCompyes/no0 task completeness percentage (0-100); not required for groups
pGroupno0 if set to 1, this is a grouping task (use this task id as other tasks' parent to make them grouped by this task)
pParentno0 id of a grouping task that is a parent of this task
pOpenno1 this is only meaningful for groups - if set to 1, this group will be closed by default (subtasks will be hidden)
pDependno11 id of a task that this task depends on (will be indicated by an arrow)

Note. You might skip some required values if you put tags directly in your article (loading a diagram from an external article is not advised anyway - left for backward compatibility).

Example

Rendering of the code

Example code:

<jsgantt>
<task>
	<pID>10</pID>
	<pName>WCF Changes</pName>
	<pColor>0000ff</pColor>
	<pLink></pLink>
	<pMile>0</pMile>
	<pRes></pRes>
	<pComp>0</pComp>
	<pGroup>1</pGroup>
	<pParent>0</pParent>
	<pOpen>1</pOpen>
	<pDepend></pDepend>
</task>
<task>
	<pID>20</pID>
	<pName>Move to WCF from remoting</pName>
	<pStart>2010-07-11</pStart>
	<pEnd>2010-07-15</pEnd>
	<pColor>0000ff</pColor>
	<pLink></pLink>
	<pMile>0</pMile>
	<pRes>Rich</pRes>
	<pComp>10</pComp>
	<pGroup>0</pGroup>
	<pParent>10</pParent>
	<pOpen>1</pOpen>
	<pDepend></pDepend>
</task>
<task>
	<pID>30</pID>
	<pName>add Auditing</pName>
	<pStart>2010-07-19</pStart>
	<pEnd>2010-07-21</pEnd>
	<pColor>0000ff</pColor>
	<pLink></pLink>
	<pMile>0</pMile>
	<pRes>Mal</pRes>
	<pComp>50</pComp>
	<pGroup>0</pGroup>
	<pParent>10</pParent>
	<pOpen>1</pOpen>
	<pDepend>20</pDepend>
</task>
</jsgantt>

Diagram options

As of 0.6.0, you can set some extra Gantt options from the MediaWiki code, e.g.:

<jsgantt option-caption-type="Complete" option-show-resource="1" option-show-duration="1">
...
</jsgantt>

Those options allow you to enable features for specific Gantt diagrams without changing the extension configuration.

Available options

All of the available options are:

  • option-show-responsible - show responsible column (defaults to 0 - hidden)
  • option-show-duration - show duration column (defaults to 0 - hidden)
  • option-show-precent-complete - show percent complete column (defaults to 0 - hidden)
  • option-show-start-date - show start date column (defaults to 0 - hidden)
  • option-show-end-date - show end date column (defaults to 0 - hidden)
  • option-caption-type - task caption (right side annotation) type. Available types: None, Caption, Resource (default), Duration, Complete.

Using options in MediaWiki 1.16

Note! Those options will NOT work in MediaWiki 1.16 or lower. You need to patch includes/Sanitizer.php by changing:

$attrib = '[A-Za-z0-9]';

to:

$attrib = '[A-Za-z0-9\-]';

Installation

  1. Download, extract and place the files them under $IP/extensions/JSWikiGantt
  2. At the end of LocalSettings.php, add:
    require_once "$IP/extensions/JSWikiGantt/JSWikiGantt.php";
    
  3. Installation can now be verified through Special:Version on your wiki
  4. If you use Apache's mod_rewrite to beautify your wiki's URLs, add a RewriteCond to Apache's config to exclude the path to your JSWikiGantt installation from rewriting. Example: RewriteCond %{REQUEST_URI} !^/YOUR_WIKI_PATH/extensions/(JSWikiGantt|MORE_EXTENSIONS_THAT_NEED_TO_LOAD_JS-FILES_FROM_THEIR_PATH)/

See also

Category:All extensions Category:BSD licensed extensions Category:Extensions in GitHub version control Category:Extensions incompatible with 1.39 Category:Extensions not in ExtensionJson Category:Extensions without MediaWiki version Category:Extensions without a compatibility policy Category:ParserAfterTidy extensions Category:ParserFirstCallInit extensions Category:Tag extensions Category:Unmaintained extensions