mantisbt:issue:8253
This is an old revision of the document!
Table of Contents
Improved Mantis/DokuWiki integration
This description is not complete! Please come back in a few days.
The following description works with mantis version 1.1.0rc2 and dokuwiki version 2007-06-26b. It based on this description, but extend the integration.
Dokuwiki
Grab the latest (2007-06-26b) version and install it. Make sure it is working properly.
Mantis Syntax Plug-in
For the syntax-plugin with support for the dokuwiki admin panel, you have to create several files:
\lib\plugins\mantis\syntax.php
<?php
/**
* Mantis Plugin: Hyperlinks references to Mantis Issues
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Timo Falk
*/
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
/**
* A plug-in that hyper links references to Mantis issues. References
* to Mantis issues should use the following format: ~~Mantis:123~~.
*
* All DokuWiki plugins to extend the parser/rendering mechanism
* need to inherit from this class
*/
class syntax_plugin_mantis extends DokuWiki_Syntax_Plugin {
/**
* return some info
*/
function getInfo(){
return array(
'author' => 'Timo Falk',
'email' => 'Timo . Falk at gmx . de',
'date' => '2007-11-01',
'name' => 'Mantis enhanced Issues Plugin',
'desc' => 'Support References to Mantis Issues. Based on Mantis Issues Plugin by Victor Boctor',
);
}
/**
* What kind of syntax are we?
*/
function getType(){
return 'substition'; # typo is intentional
}
/**
* What about paragraphs?
*/
function getPType(){
return 'normal';
}
/**
* Where to sort in?
*/
function getSort(){
return 156;
}
/**
* Connect pattern to lexer
*/
function connectTo($mode) {
$this->Lexer->addSpecialPattern('\{\{Mantis:[0-9]+\}\}', $mode, 'plugin_mantis');
}
/**
* Handle the match
*/
function handle($match, $state, $pos, &$handler){
$match = substr( $match, 9, -2 ); // strip "{{Mantis:" from start and "}}" from end
return array( strtolower( $match ) );
}
/**
* Create output
*/
function render($format, &$renderer, $data) {
if ( $format == 'xhtml' ) {
// $renderer->externallink( $this->getConf('mantis_url') . 'view.php?id=' . $data[0], $data[0] );
$link['target'] = $conf['target']['wiki'];
$link['style'] = '';
$link['pre'] = '';
$link['suf'] = '';
$link['more'] = '';
$link['class'] = 'mantislink';
$link['url'] = $this->getConf('mantis_url') . 'view.php?id=' . $data[0];
$link['name'] = $this->getConf('LinkPrefix') . $data[0];
$link['title'] = $renderer->_xmlEntities($url);
//output formatted
$renderer->doc .= $renderer->_formatLink($link);
return true;
}
return false;
}
}
?>
dokuwiki\lib\plugins\mantis\style.css
div.dokuwiki a.mantislink {
background: transparent url(images/bug.gif) 0px 1px no-repeat;
padding: 1px 0px 1px 16px;
}
dokuwiki\lib\plugins\mantis\conf\default.php
dokuwiki\lib\plugins\mantis\conf\metadata.php
dokuwiki\lib\plugins\mantis\images\bug.gif
A Picture with a little bug, placed in front of the bug links. The file is grabed from dokuwiki.org
dokuwiki\lib\plugins\mantis\lang\en\settings.php
Mantis
mantisbt/issue/8253.1194350611.txt.gz · Last modified: 2008/10/29 04:36 (external edit)
