Extension:OtrsTicket


 * This extension is work in progress – contact the author for questions regarding the state of the work

OtrsTicket adds a limited ability to do read-only access of attributes from one or more OTRS instances, allowing easy integration with OTRS for the purpose of displaying current state of the tickets. It will enforce policy on access according to LocalSettings.php, and all data made available will be readable for everyone with read access to the generated page. Multiple OTRS-instances can be configurated, with different access policy for each one.

Usage
One or more external instances of OTRS, a ticketing system, is queried over the SOAP interface about the set values of a number of attributes. Each value is either reported as a single value or as a composite structure, each with or without a leading identifier. The purpose of the reporting is for embedding the information within a human readable page, still there can be additional markup to make the information machine readable.

Querying attributes
Basic usage is to access a ticket through the ticket number, optionally querying one or more attributes

The instance must be given and this identifies the OTRS-system. An instance has the necessary log on tokens and access policy for the individual data fields. These will be set in  and can't be overridden.

Many requests assume a ticket id, not the ticket number so a translation between these types will be done and cached for a short time. Several states must be recreated for each page, for example log in state, and will be cached for the duration of the page creation. The state as such will not be cached. (Log in state could be cached)

Some requests that is usually not human readable (or human friendly) will be translated to a more friendly form. This may give an additional request to the OTRS-system, and will be cached if possible.

Querying tickets
Basic usage is to search for multiple tickets, optionally querying one or more attributes

The instance must be given and this identifies the OTRS-system. An instance has the necessary log on tokens, the access policy for the individual data fields and filters (regexps) for the query strings. These will be set in  and can't be overridden.

Some replies that is usually not human readable (or human friendly) will be translated to a more friendly form. This may give an additional request to the OTRS-system, and will be cached if possible.

Adapting presentation
A number of values can be changed that changes the presentation. Defaults are system messages that are overridden by named parameters. If the format is for complex presentation, it will not use the dataseparator and the attribute names will be included. If the format is for simple presentation, it will only use the dataseparator and no attribute names.

A standardized form is used in the message namespace, MediaWiki:otrs-function-parameter. Available parameters are
 * dataprepend : Initial message rendered before any data output. Makes available instance function name and ticket number. Defaults to, that is it starts a data list.
 * datatext : Formats the attribute name. Makes available the name and any translations. Part of the complex presentation. Defaults to, that is the translated string.
 * datadefinition : Formats the attribute value. Makes available the value. Part of the complex presentation. Defaults to, that is an identity function.
 * dataappend : Final message rendered after any data output. Makes nothing available. Defaults to, that is it ends a data list.
 * dataseparator : A message rendered between each value. Makes nothing available. Part of the complex presentation. Defaults to, that is [space][middot][space].
 * listprepend : Initial message rendered before any list output. Makes available instance and function name. Defaults to, that is it starts a table.
 * listitem : Formats each data item, which my be a simple or complex data item. Makes available the data item and its index. Defaults to
 * listprepend : Initial message rendered after any list output. Makes nothing available. Defaults to, that is it ends a table.
 * format : Sets the presentation to simple or complex. A single value defaults to simple while multiple defaults to complex.

Installation
The usual: Copy OtrsTicket.php and OtrsTicket.i18n.php to a subfolder OtrsTicket in the extensions folder, then add the following to LocalSettings.php:

Additionally there should be defined some OTRS-system to access

Note that any additional access policy not turned on by default must be explicitly turned on to be made available

Security issues
Greate care should be given to define the defaults, and where defaults are set to limit access you should be very careful to override those. Especially if the OTRS-system has limited access and the wiki is open, there will be possible to leak information from the OTRS-system and out to the public through the wiki.

Some search parameters should not be implemented at all.

Bugs/Todo
Errors during log in can be placed in wrong context.