MediaWiki extensions manual
JSWikiGantt
Release status: unmaintained
Implementation Tag
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.6.0 (2014-08-10)
MediaWiki 1.16+
PHP 5.1+
License BSD 2-clause "Simplified" License
Download

GitHub:

Note:
No localisation updates are
provided by translatewiki.net .

Parameters
mostly you'll want to change "$wgJSGanttConfig" (see "JSWikiGantt.config.php" for details)
Tags
<jsgantt>
Hooks used
  • ParserFirstCallInit
  • ParserAfterTidy

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

This is achieved by allowing users to add simple XML definition 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 licensing details of these modules.

Usage

To add a diagram to a page, simply 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 (very 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 autolinking 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 (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 autolinks 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 tasks depends on (will be indicated by an arrow)

Note. You might actually skip some required values if you are putting tags directly in your article (loading 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 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 certain Gantt diagram without changing the configuration of the extension.

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 you need to 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

This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.