Extension:Mantis
Mantis Release status: stable |
|
---|---|
Implementation | Tag |
Description | Displays a (customizable) list of MantisBT tickets |
Author(s) | Helmut K. C. Tessarek (tessustalk) |
Latest version | 2.1.1 (2019-06-18) |
Compatibility policy | Master maintains backward compatibility. |
MediaWiki | 1.25+ |
PHP | 5.4+ |
Database changes | No |
License | GNU General Public License 2.0 or later |
Download | GitHub: Note: |
$wgMantisConf[] |
|
<mantis> |
|
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
- status
- severity
- category
- project
- username
- version (range filtering supported)
- target_version (range filtering supported)
- fixed_in_version (range filtering supported)
- resolution
- sort by multiple columns with individual sort order
- show only certain columns
- limit the output
- suppress error and informational messages
- change header names for columns
- change the alignment of columns
- add comments to tickets
Installation
[edit]This extension is for Mantis databases running on MySQL.
- 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" );
- 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';
$wgMantisConf['ResolutionString'] = '10:open,20:fixed,30:reopened,40:unable to duplicate,50:not fixable,60:duplicate,70:not a bug,80:suspended,90:wont fix';
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 5 parameters accordingly.
The correct strings ($g_priority_enum_string
, $g_status_enum_string
, $g_status_colors
, $g_severity_enum_string
, $g_resolution_enum_string
) can be found in the file config_defaults_inc.php
in your Mantis directory.
Performance Considerations
[edit]Some of the filters use columns for which no corresponding indexes exist in the Mantis database.
The same is true for columns that can be used in orderby
to sort the output.
If you experience performance issues, please talk to your Mantis database admin. In most cases performance should not be an issue, unless you have millions of bugs in your Mantis database, in which case you should consider to scrap your product anyway. 😏
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/>
To display the last 3 'assigned' tickets without header and without colorized rows showing columns Id, Status, Updated, and Summary:
<mantis> status = assigned header = false color = false count = 3 show = id, status, updated, summary </mantis>
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
|
---|---|
Format | value [, value, ...]
|
Value(s) | 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
|
---|---|
Format | value
|
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
|
---|---|
Format | value
|
Value(s) | true|yes|on, false|no|off
|
Default | true
|
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
|
---|---|
Format | value
|
Value(s) | a valid date format string |
Default | Y-m-d
|
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
, version
, target_version
, fixed_in_version
, resolution
, 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
|
---|---|
Format | value [, value, ...]
|
Value(s) | id, project, category, severity, priority, status, username, created, updated, version, target_version, fixed_in_version, resolution, summary
|
Default | id, category, severity, status, updated, summary
|
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 (see Configuration).
Parameter | status
|
---|---|
Format | value [, value, ...]
|
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 (see Configuration).
Parameter | severity
|
---|---|
Format | value [, value, ...]
|
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
|
---|---|
Format | value [, value, ...]
|
Value(s) | 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
|
---|---|
Format | value [, value, ...]
|
Value(s) | project name |
Default |
username
[edit]username
allows to filter tickets by username. Only usernames defined in the database are valid. If the input value is not recognized, it will be ignored.
Parameter | username
|
---|---|
Format | value [, value, ...]
|
Value(s) | username |
Default |
version
[edit]version
allows to filter tickets by version. Only versions defined in the database are valid. If the input value is not recognized, it will be ignored.
Range Filtering is supported. Please see section Range Filtering for more details.
Parameter | version
|
---|---|
Format | value [, value, ...]
|
Value(s) | version |
Default |
target_version
[edit]target_version
allows to filter tickets by target_version. Only target_versions defined in the database are valid. If the input value is not recognized, it will be ignored.
Range Filtering is supported. Please see section Range Filtering for more details.
Parameter | target_version
|
---|---|
Format | value [, value, ...]
|
Value(s) | target version |
Default |
fixed_in_version
[edit]fixed_in_version
allows to filter tickets by fixed_in_version. Only fixed_in_versions defined in the database are valid. If the input value is not recognized, it will be ignored.
Range Filtering is supported. Please see section Range Filtering for more details.
Parameter | fixed_in_version
|
---|---|
Format | value [, value, ...]
|
Value(s) | fixed in version |
Default |
resolution
[edit]resolution
allows to filter tickets by resolution. In a standard Mantis environment, the following values are valid: open
, fixed
, reopened
, unable to duplicate
, not fixable
, duplicate
, not a bug
, suspended
, and wont fix
.
If you have a customized $wgMantisConf['ResolutionString']
, the resolution names listed in the parameter are valid values (see Configuration).
Parameter | category
|
---|---|
Format | value [, value, ...]
|
Value(s) | open, fixed, reopened, unable to duplicate, not fixable, duplicate, not a bug, suspended, wont fix
|
Default |
orderby
[edit]orderby
determines by which columns the table is sorted. The default value is updated desc
, which is the date the ticket was last updated with a reverse sort order (most recent tickets first). Valid values are id
, project
, category
, severity
, priority
, status
, username
, created
, updated
, version
, target_version
, fixed_in_version
, resolution
, and summary
. The additional values asc
and desc
can be appended to specify the sort order for that column. 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
, severity
, and resolution
are sorted by their numerical value (see Configuration), not their name.
Parameter | orderby, ordermethod, sortkey
|
---|---|
Format | value [asc|desc| [, value [asc|desc], ...]
|
Value(s) | id, project, category, severity, priority, status, username, created, updated, version, target_version, fixed_in_version, resolution, summary
|
Default | updated desc
|
order
[edit]Note: This option is deprecated, but still available for backwards compatibility. It will be ignored unless orderby
specifies a single column without a sort order!
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
|
---|---|
Format | value
|
Value(s) | asc|ascending, desc|descending
|
Default | desc
|
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
|
---|---|
Format | value
|
Value(s) | number of results to show |
Default |
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
|
---|---|
Format | value
|
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
|
---|---|
Format | value
|
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
|
---|---|
Format | value
|
Value(s) | true|yes|on, false|no|off
|
Default | false
|
headername
[edit]headername
makes it possible to change the header names of table columns. They are specified by using the following format: headername<delimiter><colname> = text
, where <delimiter>
can be any character. Valid values for <colname>
are all valid values for the option show
.
Parameter | headername<delimiter><colname>
|
---|---|
Format | value
|
Value(s) | header name for column |
Default |
Example:
headername.fixed_in_version = Fixed In
align
[edit]align
makes it possible to change the alignment of table columns. They are specified by using the following format: align<delimiter><colname> = value
, where <delimiter>
can be any character. Valid values for <colname>
are all valid values for the option show
.
Parameter | align<delimiter><colname>
|
---|---|
Format | value
|
Value(s) | l|left, c|center, r|right
|
Default |
Example:
align.fixed_in_version = left
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>
|
---|---|
Format | value
|
Value(s) | comment to be added to <bugid>
|
Default |
summary_as_comment
[edit]If summary_as_comment
is set to true, the summary is used as the comment. Explicitly set comments take precedence, which means they will not be overwritten by the summary.
Parameter | summary_as_comment
|
---|---|
Format | value
|
Value(s) | true|yes|on, false|no|off
|
Default | false
|
Range Filtering
[edit]Range Filtering is available for the following options: version
, target_version
, and fixed_in_version
Following operators are available: gt
, ge
, lt
, le
.
Operator | Meaning |
---|---|
gt | greater than |
ge | greater than or equal to |
lt | less than |
le | less than or equal to |
Maximal two operators are allowed.
Format | op value [, op value]
|
---|---|
op | gt, ge, lt, le
|
value | version |
Examples:
<mantis> status = resolved, closed fixed_in_version = gt 2.71
It is also possible to restrict the range on both ends:
status = resolved, closed fixed_in_version = gt 2.71, le 3.0