Extension:Mantis

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
Mantis

Release status:Extension status stable

ImplementationTemplate:Extension#type Tag
DescriptionTemplate:Extension#description Displays a (customizable) list of MantisBT tickets
Author(s)Template:Extension#username Helmut K. C. Tessarek (tessustalk)
Latest versionTemplate:Extension#version 1.5 (2017-02-21)
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GPLv2+
Download
TagsTemplate:Extension#tags
<mantis>
Hooks usedTemplate:Extension#hook
ParserFirstCallInitManual:Hooks/ParserFirstCallInit

Translate the Mantis extension if it is available at translatewiki.net

Check usage and version matrix.

The Mantis extension allows users to display a list of MantisBT tickets on a page.

By default it shows a color-coded table of open tickets. The following options can be customized:

  • table header on/off
  • colors on/off
  • length of summary text
  • date format
  • specify tickets by bugid
  • display tickets by status
  • display tickets by severity
  • display tickets by category
  • display tickets by project
  • sort by a column (ascending and descending)
  • show only certain columns
  • limit the output
  • suppress error and informational messages
  • add comments to tickets

Installation[edit]

  • Grab the code via git:
cd extensions
git clone https://github.com/tessus/mwExtensionMantis.git Mantis
  • Add the following code at the bottom of your LocalSettings.php:
require_once( "$IP/extensions/Mantis/Mantis.php" );
  • YesY Done – Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.

Configuration[edit]

By default the following options are set by this extension:

$wgMantisConf['DBserver']       = 'localhost'; // Mantis database server
$wgMantisConf['DBport']         = NULL;        // Mantis database port
$wgMantisConf['DBname']         = '';          // Mantis database name
$wgMantisConf['DBuser']         = '';
$wgMantisConf['DBpassword']     = '';
$wgMantisConf['DBprefix']       = '';          // Table prefix
$wgMantisConf['Url']            = '';          // Mantis Root Page
$wgMantisConf['MaxCacheTime']   = 60*60*0;     // How long to cache pages in seconds
$wgMantisConf['PriorityString'] = '10:none,20:low,30:normal,40:high,50:urgent,60:immediate';
$wgMantisConf['StatusString']   = '10:new,20:feedback,30:acknowledged,40:confirmed,50:assigned,80:resolved,90:closed';
$wgMantisConf['StatusColors']   = '10:fcbdbd,20:e3b7eb,30:ffcd85,40:fff494,50:c2dfff,80:d2f5b0,90:c9ccc4';
$wgMantisConf['SeverityString'] = '10:feature,20:trivial,30:text,40:tweak,50:minor,60:major,70:crash,80:block';

You may change each one of these parameters by including it with your specified value into your LocalSettings.php below the initialization of this extension.

Set $wgMantisConf['Url'] to the root of the Mantis web page, e.g. https://www.example.com/mantis. If you don't set it or leave it empty, the Id field will not have a link to the Mantis ticket.

If you have customized or added additional fields to your MantisBT environment, you should change the last 4 parameters accordingly. The correct strings ($g_priority_enum_string, $g_status_enum_string, $g_status_colors, $g_severity_enum_string) can be found in the file config_defaults_inc.php in your Mantis directory.

Usage[edit]

This extension can be used with XML-like syntax in the wiki edit view. The parameters control what data and how it will be displayed. See the following sections for information on each parameter. By default it will show a color-coded table of open tickets.

<mantis/>

Mantis example1.png

To display the last 3 'assigned' tickets without header and colorized rows with columns Id, Status, Updated, and Summary:

<mantis>
status = assigned
header = false
color  = false
count  = 3
show   = id, status, updated, summary
</mantis>

Mantis example2.png

Parameters[edit]

Parameters are set in the format parameter=value. Whitespaces are ignored.

bugid[edit]

bugid specifies a single ticket or a list of tickets (separated by comma). If only a single ticket is specified, header and color are turned off automatically. They can be turned on again, by setting them explicitly. If the ticket is (or the tickets are) not found, an informational message is displayed unless suppressinfo is set to true.

Parameter bugid
Value(s) a Mantis ticket id [, a Mantis ticket id, a Mantis ticket id, ...]
Default

header[edit]

header decides, if a table header will be displayed. The default value is true unless a single bugid is specified. The parameter can be set to true or false, whereas on and yes are aliases for true, and off and no are aliases for false. If the input value is not recognized, it will be ignored and the default value will be used.

Parameter header
Value(s) true/yes/on, false/no/off
Default true

color[edit]

color decides, if the table will be color-coded. The default value is true unless a single bugid is specified. The parameter can be set to true or false, whereas on and yes are aliases for true, and off and no are aliases for false. If the input value is not recognized, it will be ignored and the default value will be used.

Parameter color
Value(s) true/yes/on, false/no/off
Default true

status[edit]

status determines which tickets will be shown in the table. The default value is open, which are all tickets that are not closed. In a standard Mantis environment, the following values are valid: new, feedback, acknowledged, confirmed, assigned, resolved, closed, and all. If the input value is not recognized, it will be ignored and the default value will be used.

If you have a customized $wgMantisConf['StatusString'], the status names listed in the parameter are valid values.

Parameter status
Value(s) open, new, feedback, acknowledged, confirmed, assigned, resolved, closed, all
Default open

severity[edit]

severity allows to filter tickets by severity. In a standard Mantis environment, the following values are valid: feature, trivial, text, tweak, minor, major, crash, and block.

If you have a customized $wgMantisConf['SeverityString'], the severity names listed in the parameter are valid values.

Parameter severity
Value(s) feature, trivial, text, tweak, minor, major, crash, block
Default

category[edit]

category allows to filter tickets by category. Only category names defined in the database are valid. If the input value is not recognized, it will be ignored.

Parameter category
Value(s) category name [, category name, category name, ...]
Default

project[edit]

project allows to filter tickets by project. Only project names defined in the database are valid. If the input value is not recognized, it will be ignored.

Parameter project
Value(s) project name [, project name, project name, ...]
Default

count[edit]

count restricts the number of results that are shown. There is no default value. If the input value is not recognized, it will be ignored.

Parameter count
Value(s) number of results to show
Default

dateformat[edit]

dateformat specifies the format of the date that will be shown in the columns Updated and Created. The default value is Y-m-d.

Parameter dateformat
Value(s) a valid date format string
Default Y-m-d

orderby[edit]

orderby determines by which column the table is sorted. The default value is updated, which is the date the ticket was last updated. Valid values are id, project, category, severity, priority, status, username, created, updated, and summary. If the input value is not recognized, it will be ignored and the default value will be used. Instead of orderby, the aliases sortkey or ordermethod may be used.

Note: status, property, and severity are sorted by their numerical value (see Configuration), not their name.

Parameter orderby, ordermethod, sortkey
Value(s) id, project, category, severity, priority, status, username, created, updated, summary
Default updated

order[edit]

order decides the sort direction. The value can be descending (default, most recent to oldest, z to a) or ascending (oldest to most recent, a to z). desc is an alias for descending, and asc is an alias for ascending. If the input value is not recognized, it will be ignored and the default value will be used.

Parameter order
Value(s) asc/ascending, desc/descending
Default desc

summarylength[edit]

summarylength specifies the length of the summary text to display. If set, the summary text is cut off at the specified length. There is no default value. If the input value is not recognized, it will be ignored.

Parameter summarylength
Value(s) max length of summary text
Default

suppresserrors[edit]

suppresserrors hides database errors, like connection errors. The value can be true (hide errors) or false (default, show errors). on and yes are aliases for true, and off and no are aliases for false. If the input value is not recognized, it will be ignored and the default value will be used.

Parameter suppresserrors
Value(s) true/yes/on, false/no/off
Default false

suppressinfo[edit]

suppressinfo hides informational messages, e.g. that no ticket with a specified bugid was found or that there are no tickets with a certain status. The value can be true (hide informational messages) or false (default, show informational messages). on and yes are aliases for true, and off and no are aliases for false. If the input value is not recognized, it will be ignored and the default value will be used.

Parameter suppressinfo
Value(s) true/yes/on, false/no/off
Default false

show[edit]

show specifies which columns are shown in the table. By default the following columns are shown: id, project, category, severity, status, updated, and summary. Valid values are id, category, severity, priority, status, username, created, updated, and summary. If the input value is not recognized, it will be ignored. Are all of the input values invalid, the default columns are shown.

Parameter show
Value(s) id, project, category, severity, priority, status, username, created, updated, summary
Default id, category, severity, status, updated, summary

comment[edit]

comment makes it possible to add comments to tickets. They are specified by using the following format: comment<delimiter><bugid> = text, where <delimiter> can be any character. The following 3 expressions, which will add the comment to ticket number 42, are equivalent:

comment.42 = Answer to the Ultimate Question of Life, The Universe, and Everything
comment#42 = Answer to the Ultimate Question of Life, The Universe, and Everything
comment/42 = Answer to the Ultimate Question of Life, The Universe, and Everything
Parameter comment<delimiter><bugid>
Value(s) comment to be added to <bugid>
Default