Extension: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
This extension is for Mantis databases running on MySQL.


 * Grab the code via git:
 * Add the following code at the bottom of your LocalSettings.php:
 * ✅ – Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.

Configuration
By default the following options are set by this extension:

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

Set  to the root of the Mantis web page, e.g.  . 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 can be found in the file   in your Mantis directory.

Performance Considerations
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  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. &#x1F60F;

Usage
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.



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

status = assigned header = false color = false count = 3 show  = id, status, updated, summary



Parameters
Parameters are set in the format. Whitespaces are ignored.

bugid
specifies a single ticket or a list of tickets (separated by comma). If only a single ticket is specified,  and   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  is set to.

{| class="wikitable" ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Parameter ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Format ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Value(s) ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" | Default The parameter can be set to  or , whereas   and   are aliases for  , and   and   are aliases for. If the input value is not recognized, it will be ignored and the default value will be used.
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |a Mantis ticket id
 * style="padding-left:5px; padding-right:5px;"                             |   decides, if a table header will be displayed. The default value is   unless a single   is specified.

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

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

show
specifies which columns are shown in the table. By default the following columns are shown:,  ,  ,  ,  ,  , and. Valid values are,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  , and. If the input value is not recognized, it will be ignored. Are all of the input values invalid, the default columns are shown.

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

If you have a customized, the status names listed in the parameter are valid values (see  Configuration).

severity
allows to filter tickets by severity. In a standard Mantis environment, the following values are valid:,  ,  ,  ,  ,  ,  , and.

If you have a customized, the severity names listed in the parameter are valid values (see  Configuration).

{| class="wikitable" ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Parameter ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Format ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Value(s) ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" | Default
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |   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.

{| class="wikitable" ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Parameter ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Format ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Value(s) ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" | Default
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |category name
 * style="padding-left:5px; padding-right:5px;"                             |   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.

{| class="wikitable" ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Parameter ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Format ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Value(s) ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" | Default
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |project name
 * style="padding-left:5px; padding-right:5px;"                             |   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.

{| class="wikitable" ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Parameter ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Format ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Value(s) ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" | Default
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |username
 * style="padding-left:5px; padding-right:5px;"                             |   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.

{| class="wikitable" ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Parameter ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Format ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Value(s) ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" | Default
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |version
 * style="padding-left:5px; padding-right:5px;"                             |   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.

{| class="wikitable" ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Parameter ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Format ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Value(s) ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" | Default
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |target version
 * style="padding-left:5px; padding-right:5px;"                             |   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.

{| class="wikitable" ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Parameter ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Format ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Value(s) ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" | Default
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |fixed in version
 * style="padding-left:5px; padding-right:5px;"                             |   allows to filter tickets by resolution. In a standard Mantis environment, the following values are valid: ,  ,  ,  ,  ,  ,  ,  , and.

If you have a customized, the resolution names listed in the parameter are valid values (see  Configuration).

{| class="wikitable" ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Parameter ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Format ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Value(s) ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" | Default Instead of, the aliases   or   may be used.
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |   determines by which columns the table is sorted. The default value is , which is the date the ticket was last updated with a reverse sort order (most recent tickets first). Valid values are  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  , and  . The additional values   and   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.

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

order
Note: This option is deprecated, but still available for backwards compatibility. It will be ignored unless  specifies a single column without a sort order!

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

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.

{| class="wikitable" ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Parameter ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Format ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Value(s) ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" | Default
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |number of results to show
 * style="padding-left:5px; padding-right:5px;"                             |   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.

{| class="wikitable" ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Parameter ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Format ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Value(s) ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" | Default
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |max length of summary text
 * style="padding-left:5px; padding-right:5px;"                             |   hides database errors, like connection errors. The value can be   (hide errors) or   (default, show errors).   and   are aliases for , and   and   are aliases for  . If the input value is not recognized, it will be ignored and the default value will be used.

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

headername
makes it possible to change the header names of table columns. They are specified by using the following format:, where   can be any character. Valid values for  are all valid values for the option.

{| class="wikitable" ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Parameter ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Format ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Value(s) ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" | Default
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |header name for column
 * style="padding-left:5px; padding-right:5px;"                             |   makes it possible to change the alignment of table columns. They are specified by using the following format: , where   can be any character. Valid values for   are all valid values for the option.

{| class="wikitable" ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Parameter ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Format ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Value(s) ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" | Default 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
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |   makes it possible to add comments to tickets. They are specified by using the following format: , where   can be any character. The following 3 expressions, which will add the comment to ticket number 42, are equivalent:

{| class="wikitable" ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Parameter ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Format ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" |Value(s) ! scope="row" style="text-align:left; padding-left:5px; padding-right:5px;" | Default
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |
 * style="padding-left:5px; padding-right:5px;"                             |comment to be added to
 * style="padding-left:5px; padding-right:5px;"                             | ,  , and

Following operators are available:,  ,  ,.

Maximal two operators are allowed.

Examples:

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