Extension:TODOListProgressBar

What can this extension do?
This extension is aimed at making the process of tracking the progress of a TODO list (or other list) easier. When creating your TODO list, you include the tag along with each item. As you complete an item, you update its status accordingly and the rest of the extension takes care of displaying the nice progress bar for a visual indicator as to the progress of completing the TODO list. In addition, it places a status string where the tag is located so that your TODO list will tell you which items are complete and which arent.

Usage
The tag has two modes of operation:
 * Item Mode   -  or Item Text
 * Graphic Mode -  or Caption Text

All tags require the "type" attribute. It only has two values: This tells the code what to do with the tag. As such, it has no default value.
 * "item"
 * "graphic"

For Item Mode, the parameters are as follows:
 * name
 * The name of the item. This parameter is a string value and must be unique for the group the item is in. If this parameter is not given, a unique value will be assigned. This parameter is optional.


 * status
 * Determines the staus of the item. The default value is "incomplete". This parameter is optional. Valid values are:
 * The item is complete.
 * "complete"
 * "completed"
 * "done"
 * "finished"
 * The item is being worked on but is not completed (counts as incomplete).
 * "ip"
 * "in progress"
 * "working"
 * The status of the item is unknown (counts as incomplete).
 * "unknown"
 * The item is incomplete or has not been started on.
 * "incomplete"
 * "pending"
 * "held"


 * group
 * The group an item belongs to. This parameter is a string value. The default value for this parameter is "global". Group names cannot contain commas as part of their name. This parameter is optional.


 * value
 * The "point value" of this item. The default value for any item is 1. This parameter is an integer value. This changes the point value of the item, and changes the final point value of the entire group. This parameter is optional.


 * nostatus
 * This is a single word parameter that will hide the status indicator. This can be useful if you just want to track items but aren't worried about them being marked in the list itself. This parameter is optional.


 * $text
 * The text for the item. This will be the text that is between the  tags. This parameter is optional.

When an item is complete, its point value is added to the total of completed items and rendered in the graphic.

For Graphics Mode, the parameters are as follows:
 * group
 * The group of items that are going to be rendered. This parameter is a string value. The default value for this parameter is "global". This parameter is optional.


 * color
 * The color that will be used to fill the progress bar. The default value is black. This parameter is any valid hex RGB value or HTML color. This parameter is optional.


 * height
 * The height (in pixles, aka "px") of the progress bar. The default value is 10px. This parameter is an integer value. This parameter is optional.


 * width
 * The width (in pixels, aka "px") of the progress bar. The default value is 400px. This parameter is an integer value. This parameter is optional.


 * noerase
 * This is a single word paremeter that will prevent the data for a group from being deleted. This could be useful for implementing an "advanced features todo list". In such a list, the basic features are listed first (which then display their own progress bar) followed by the advanced features (which then displays another progress bar containing both sets of items). This parameter is optional.


 * multilist
 * This is a single word parameter that allows the combining of multiple lists into a single progress bar. This is useful for when you want to display lists of data that are separate but want to have a single progress bar to cover all of the lists. The lists to be combined are given in the "group" parameter separated by commas (group names cannot contain commas). The "noerase" parameter works with this parameter. This parameter is optional.


 * $text
 * The text for the progress bar caption. This will be the text that is between the  tags. This parameter is optional.

It is important to note that you cannot (at this point) place the progress bar tag before the item tags. This is due to the fact that HTML is parsed top down, as well as the fact that I have not added any AJAX that would bypass this restriction. Maybe for the next version...

Examples
Examples can be found here. These are working examples.

If you think of an example that should be included, let me know via the discussion page.

Download instructions
Please cut and paste the code found below and place it in. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
To install this extension, add the following to LocalSettings.php:

Credits
A portion of this code is based directly on Progressbar, I have merely modified it to work with my needs. I take no credit for the portion that is based on Progressbar.

Change Log

 * 20100612.0
 * Inital release
 * 20100613.0
 * Changed all the div elements to use the inline display style rather than the block style.
 * 20100613.1
 * Realized I added an inline where I shouldn't have.
 * Fixed some nasty XSS bugs I had introduced. (Thanks to Max Semenik for noticing this.)
 * Changed the  tag to allow text to appear between the tags and be displayed along with the status indicator.
 * 20100613.2
 * Made the name parameter optional to simplify the tag syntax.
 * Added a "nostatus" parameter to the item tag.
 * Added an "unknown" status value.
 * 20100613.3
 * Fixed a bug related to "nostatus" causing items marked with nostatus to not be calcualted in the final tally.
 * 20100613.4
 * Added code to allow the parsing of wikitext from within the tags. (Made it XSS safe.)
 * Added a "noerase" parameter to the graphic tag.
 * 20100614.0
 * Added the "multilist" parameter to allow combining of data sets into one progress bar.
 * Stubbed in part of the "values" tag code.

TODO (pun)

 * 1) Add a  for setting page wide defaults.
 * 2) This will require an array to store the defaults so they can be changed.
 * 3) Add a  that will output the name, value, and status of each item in a group.
 * 4) Add a "percent" parameter that allows giving a percent complete value to items that are not completed.
 * 5) This will cause only a portion of the items value to be added to the final tally.